small fix for server details being missing, stop crash and just try connection

dont return None for server details being missing, throw as we need to get to the botton of this
This commit is contained in:
sfaulds 2017-01-30 16:05:41 +11:00
parent d9b0f902e6
commit 4096e0ad5c
3 changed files with 8 additions and 9 deletions

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.emby" <addon id="plugin.video.emby"
name="Emby" name="Emby"
version="2.3.40" version="2.3.41"
provider-name="Emby.media"> provider-name="Emby.media">
<requires> <requires>
<import addon="xbmc.python" version="2.19.0"/> <import addon="xbmc.python" version="2.19.0"/>

View file

@ -539,12 +539,12 @@ class ConnectionManager(object):
log.info("skipping test at index: %s" % index) log.info("skipping test at index: %s" % index)
return self._testNextConnectionMode(tests, index+1, server, options) return self._testNextConnectionMode(tests, index+1, server, options)
log.info("testing connection mode %s with server %s" % (mode, server['Name'])) log.info("testing connection mode %s with server %s" % (mode, server.get('Name')))
try: try:
result = self._tryConnect(address, timeout, options) result = self._tryConnect(address, timeout, options)
except Exception: except Exception:
log.error("test failed for connection mode %s with server %s" % (mode, server['Name'])) log.error("test failed for connection mode %s with server %s" % (mode, server.get('Name')))
if enableRetry: if enableRetry:
# TODO: wake on lan and retry # TODO: wake on lan and retry
@ -561,7 +561,7 @@ class ConnectionManager(object):
} }
else: else:
log.info("calling onSuccessfulConnection with connection mode %s with server %s" log.info("calling onSuccessfulConnection with connection mode %s with server %s"
% (mode, server['Name'])) % (mode, server.get('Name')))
return self._onSuccessfulConnection(server, result, mode, options) return self._onSuccessfulConnection(server, result, mode, options)
def _onSuccessfulConnection(self, server, systemInfo, connectionMode, options): def _onSuccessfulConnection(self, server, systemInfo, connectionMode, options):

View file

@ -217,8 +217,10 @@ class DownloadUtils(object):
server = self.session if server_id is None else self.servers[server_id] server = self.session if server_id is None else self.servers[server_id]
if server is None or server.get("Server", None) is None or server.get("UserId", None) is None: if server is None or server.get("Server", None) is None or server.get("UserId", None) is None:
log.info("Aborting download, Server Details Error: %s", server) log.info("Aborting download, Server Details Error: %s url=%s" % (server, url))
return None exc = Exception("Aborting download, Server Details Error: %s url=%s" % (server, url))
#exc.quiet = True
raise exc
if server_id is None and self.session_requests is not None: # Main server if server_id is None and self.session_requests is not None: # Main server
session = self.session_requests session = self.session_requests
@ -346,9 +348,6 @@ class DownloadUtils(object):
log.error("unknown error connecting to: %s", url) log.error("unknown error connecting to: %s", url)
raise raise
# something went wrong so return a None as we have no valid data
return None
def _ensure_server(self, server_id=None): def _ensure_server(self, server_id=None):
if server_id is None and self.session_requests is None: if server_id is None and self.session_requests is None: