Connect to remote PMS
This commit is contained in:
parent
1ab657cd0b
commit
100421ce2d
4 changed files with 26 additions and 18 deletions
|
@ -295,13 +295,13 @@ class PlexAPI():
|
|||
verify=verify,
|
||||
timeout=timeout)
|
||||
except requests.exceptions.ConnectionError as e:
|
||||
self.logMsg("Server is offline or cannot be reached. Url: %s."
|
||||
"Header: %s. Error message: %s"
|
||||
% (url, header, e), -1)
|
||||
self.logMsg("Server is offline or cannot be reached. Url: %s. "
|
||||
"Error message: %s"
|
||||
% (url, e), -1)
|
||||
return False
|
||||
except requests.exceptions.ReadTimeout:
|
||||
self.logMsg("Server timeout reached for Url %s with header %s"
|
||||
% (url, header), -1)
|
||||
self.logMsg("Server timeout reached for Url %s"
|
||||
% url, -1)
|
||||
return False
|
||||
# We received an answer from the server, but not as expected.
|
||||
if answer.status_code >= 400:
|
||||
|
|
|
@ -359,7 +359,7 @@ class DownloadUtils():
|
|||
except requests.exceptions.ConnectionError as e:
|
||||
# Make the addon aware of status
|
||||
if utils.window('emby_online') != "false":
|
||||
self.logMsg("Server unreachable at: %s" % url, 0)
|
||||
self.logMsg("Server unreachable at: %s" % url, -1)
|
||||
self.logMsg(e, 2)
|
||||
utils.window('emby_online', value="false")
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class InitialSetup():
|
|||
plexLogin = plexdict['plexLogin']
|
||||
plexToken = plexdict['plexToken']
|
||||
plexid = plexdict['plexid']
|
||||
self.logMsg('Plex info retrieved from settings: %s' % plexdict, 1)
|
||||
self.logMsg('Plex info retrieved from settings', 1)
|
||||
|
||||
dialog = xbmcgui.Dialog()
|
||||
|
||||
|
@ -120,8 +120,13 @@ class InitialSetup():
|
|||
resp = dialog.select(string(39012), dialoglist)
|
||||
server = serverlist[resp]
|
||||
activeServer = server['machineIdentifier']
|
||||
url = server['scheme'] + '://' + server['ip'] + ':' + \
|
||||
server['port']
|
||||
# Re-direct via plex if remote - will lead to the correct SSL
|
||||
# certificate
|
||||
if server['local'] == '1':
|
||||
url = server['scheme'] + '://' + server['ip'] + ':' \
|
||||
+ server['port']
|
||||
else:
|
||||
url = server['baseURL']
|
||||
# Deactive SSL verification if the server is local!
|
||||
if server['local'] == '1':
|
||||
utils.settings('sslverify', 'false')
|
||||
|
@ -166,18 +171,21 @@ class InitialSetup():
|
|||
break
|
||||
if not isconnected:
|
||||
# Enter Kodi settings instead
|
||||
if dialog.yesno(
|
||||
heading=self.addonName,
|
||||
line1=string(39016)):
|
||||
self.logMsg("User opted to disable Plex music library.", 1)
|
||||
utils.settings('enableMusic', value="false")
|
||||
xbmc.executebuiltin('Addon.OpenSettings(%s)' % self.addonId)
|
||||
return
|
||||
# Write to Kodi settings file
|
||||
utils.settings('plex_machineIdentifier', activeServer)
|
||||
utils.settings('ipaddress', server['ip'])
|
||||
utils.settings('port', server['port'])
|
||||
if server['scheme'] == 'https':
|
||||
if server['local'] == '1':
|
||||
scheme = server['scheme']
|
||||
utils.settings('ipaddress', server['ip'])
|
||||
utils.settings('port', server['port'])
|
||||
else:
|
||||
baseURL = server['baseURL'].split(':')
|
||||
scheme = baseURL[0]
|
||||
utils.settings('ipaddress', baseURL[1].replace('//', ''))
|
||||
utils.settings('port', baseURL[2])
|
||||
|
||||
if scheme == 'https':
|
||||
utils.settings('https', 'true')
|
||||
else:
|
||||
utils.settings('https', 'false')
|
||||
|
|
|
@ -381,7 +381,7 @@ class UserClient(threading.Thread):
|
|||
settings('userId', value="")
|
||||
|
||||
# Give attempts at entering password / selecting user
|
||||
if self.retry >= 3:
|
||||
if self.retry >= 2:
|
||||
log("Too many retries to login.", -1)
|
||||
window('emby_serverStatus', value="Stop")
|
||||
dialog.ok(lang(33001),
|
||||
|
|
Loading…
Reference in a new issue