mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-12 21:26:10 +00:00
Fix slowness
This commit is contained in:
parent
586717c7a1
commit
2ec188341c
3 changed files with 15 additions and 10 deletions
|
@ -277,8 +277,17 @@ class GetItemWorker(threading.Thread):
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
request = {
|
||||||
|
'type': "GET",
|
||||||
|
'handler': "Users/{UserId}/Items",
|
||||||
|
'params': {
|
||||||
|
'Ids': ','.join(str(x) for x in item_ids),
|
||||||
|
'Fields': api.info()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = self.server['api'].get_items(item_ids)
|
result = self.server['http/request'](request, s)
|
||||||
|
|
||||||
for item in result['Items']:
|
for item in result['Items']:
|
||||||
|
|
||||||
|
@ -313,11 +322,7 @@ class TheVoid(object):
|
||||||
self.method = method
|
self.method = method
|
||||||
self.data = data
|
self.data = data
|
||||||
|
|
||||||
def get(self, timeout=None, default=None):
|
def get(self):
|
||||||
|
|
||||||
''' Timeout in seconds, if exceeded will return the default value.
|
|
||||||
'''
|
|
||||||
last_progress = datetime.today()
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|
||||||
|
@ -330,12 +335,12 @@ class TheVoid(object):
|
||||||
|
|
||||||
return response
|
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'])
|
LOG.info("Abandon mission! A black hole just swallowed [ %s/%s ]", self.method, self.data['VoidName'])
|
||||||
|
|
||||||
return default
|
return default
|
||||||
|
|
||||||
xbmc.sleep(10)
|
xbmc.sleep(100)
|
||||||
|
|
||||||
def get_objects(src, filename):
|
def get_objects(src, filename):
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ class Events(object):
|
||||||
|
|
||||||
elif mode =='play':
|
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')
|
Actions(server).play(item, params.get('dbid'), playlist=params.get('playlist') == 'true')
|
||||||
|
|
||||||
elif mode == 'playlist':
|
elif mode == 'playlist':
|
||||||
|
|
|
@ -228,7 +228,7 @@ class Service(xbmc.Monitor):
|
||||||
LOG.debug("[ %s: %s ] %s", sender, method, json.dumps(data, indent=4))
|
LOG.debug("[ %s: %s ] %s", sender, method, json.dumps(data, indent=4))
|
||||||
|
|
||||||
if method == 'ServerOnline':
|
if method == 'ServerOnline':
|
||||||
if data['ServerId'] is None:
|
if data.get('ServerId') is None:
|
||||||
|
|
||||||
window('emby_online.bool', True)
|
window('emby_online.bool', True)
|
||||||
self.settings['auth_check'] = True
|
self.settings['auth_check'] = True
|
||||||
|
|
Loading…
Reference in a new issue