diff --git a/resources/lib/downloader.py b/resources/lib/downloader.py index f63ceacf..7b0f7140 100644 --- a/resources/lib/downloader.py +++ b/resources/lib/downloader.py @@ -277,8 +277,17 @@ class GetItemWorker(threading.Thread): return + request = { + 'type': "GET", + 'handler': "Users/{UserId}/Items", + 'params': { + 'Ids': ','.join(str(x) for x in item_ids), + 'Fields': api.info() + } + } + try: - result = self.server['api'].get_items(item_ids) + result = self.server['http/request'](request, s) for item in result['Items']: @@ -313,11 +322,7 @@ class TheVoid(object): self.method = method self.data = data - def get(self, timeout=None, default=None): - - ''' Timeout in seconds, if exceeded will return the default value. - ''' - last_progress = datetime.today() + def get(self): while True: @@ -330,12 +335,12 @@ class TheVoid(object): return response - if window('emby_should_stop.bool') or timeout and (datetime.today() - last_progress).seconds > timeout: + if window('emby_should_stop.bool'): LOG.info("Abandon mission! A black hole just swallowed [ %s/%s ]", self.method, self.data['VoidName']) return default - xbmc.sleep(10) + xbmc.sleep(100) def get_objects(src, filename): diff --git a/resources/lib/entrypoint/default.py b/resources/lib/entrypoint/default.py index d76c7da4..16bfaf9c 100644 --- a/resources/lib/entrypoint/default.py +++ b/resources/lib/entrypoint/default.py @@ -68,7 +68,7 @@ class Events(object): elif mode =='play': - item = TheVoid('GetItem', {'Id': params['id'], 'ServerId': server}).get(10, {'Items': {}}) + item = TheVoid('GetItem', {'Id': params['id'], 'ServerId': server}).get() Actions(server).play(item, params.get('dbid'), playlist=params.get('playlist') == 'true') elif mode == 'playlist': diff --git a/resources/lib/entrypoint/service.py b/resources/lib/entrypoint/service.py index 66ff2919..a4c05cdd 100644 --- a/resources/lib/entrypoint/service.py +++ b/resources/lib/entrypoint/service.py @@ -228,7 +228,7 @@ class Service(xbmc.Monitor): LOG.debug("[ %s: %s ] %s", sender, method, json.dumps(data, indent=4)) if method == 'ServerOnline': - if data['ServerId'] is None: + if data.get('ServerId') is None: window('emby_online.bool', True) self.settings['auth_check'] = True