mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-26 02:36:10 +00:00
Adjust views artwork
Do not set prop if artwork not available
This commit is contained in:
parent
60db191efa
commit
d81d77d9aa
2 changed files with 23 additions and 15 deletions
|
@ -105,17 +105,17 @@ def get_filtered_section(parent_id, media=None, limit=None, recursive=None, sort
|
||||||
|
|
||||||
return _get("Users/{UserId}/Items", params, server_id)
|
return _get("Users/{UserId}/Items", params, server_id)
|
||||||
|
|
||||||
def get_movies_by_boxset(boxset_id, server_id=None):
|
def get_movies_by_boxset(boxset_id):
|
||||||
|
|
||||||
for items in get_items(boxset_id, "Movie", server_id=server_id):
|
for items in get_items(boxset_id, "Movie"):
|
||||||
yield items
|
yield items
|
||||||
|
|
||||||
def get_episode_by_show(show_id, server_id=None):
|
def get_episode_by_show(show_id):
|
||||||
|
|
||||||
for items in get_items(show_id, "Episode", server_id=server_id):
|
for items in get_items(show_id, "Episode"):
|
||||||
yield items
|
yield items
|
||||||
|
|
||||||
def get_items(parent_id, item_type=None, basic=False, params=None, server_id=None):
|
def get_items(parent_id, item_type=None, basic=False, params=None):
|
||||||
|
|
||||||
query = {
|
query = {
|
||||||
'url': "Users/{UserId}/Items",
|
'url': "Users/{UserId}/Items",
|
||||||
|
@ -127,11 +127,10 @@ def get_items(parent_id, item_type=None, basic=False, params=None, server_id=Non
|
||||||
'Fields': api.basic_info() if basic else api.info()
|
'Fields': api.basic_info() if basic else api.info()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if params:
|
if params:
|
||||||
query['params'].update(params)
|
query['params'].update(params)
|
||||||
|
|
||||||
for items in _get_items(query, server_id):
|
for items in _get_items(query):
|
||||||
yield items
|
yield items
|
||||||
|
|
||||||
def get_artists(parent_id=None, basic=False, params=None, server_id=None):
|
def get_artists(parent_id=None, basic=False, params=None, server_id=None):
|
||||||
|
|
|
@ -97,6 +97,7 @@ class Views(object):
|
||||||
|
|
||||||
sync = None
|
sync = None
|
||||||
limit = 25
|
limit = 25
|
||||||
|
media_folders = None
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
|
@ -730,11 +731,7 @@ class Views(object):
|
||||||
window('%s.id' % window_prop, view['Id'])
|
window('%s.id' % window_prop, view['Id'])
|
||||||
window('%s.path' % window_prop, window_path)
|
window('%s.path' % window_prop, window_path)
|
||||||
window('%s.type' % window_prop, view['Media'])
|
window('%s.type' % window_prop, view['Media'])
|
||||||
|
self.window_artwork(window_prop, view['Id'])
|
||||||
if self.server['connected']:
|
|
||||||
|
|
||||||
artwork = api.API(None, self.server['auth/server-address']).get_artwork(view['Id'], 'Primary')
|
|
||||||
window('%s.artwork' % window_prop, artwork)
|
|
||||||
|
|
||||||
def window_single_node(self, index, item_type, view):
|
def window_single_node(self, index, item_type, view):
|
||||||
|
|
||||||
|
@ -759,7 +756,7 @@ class Views(object):
|
||||||
else:
|
else:
|
||||||
path = self.window_path(view, node)
|
path = self.window_path(view, node)
|
||||||
|
|
||||||
if node in ('browse', 'audiobooks'):
|
if node in ('browse', 'books', 'audiobooks'):
|
||||||
window_path = path
|
window_path = path
|
||||||
else:
|
else:
|
||||||
window_path = "ActivateWindow(Videos,%s,return)" % path
|
window_path = "ActivateWindow(Videos,%s,return)" % path
|
||||||
|
@ -787,11 +784,23 @@ class Views(object):
|
||||||
window('%s.id' % window_prop, view['Id'])
|
window('%s.id' % window_prop, view['Id'])
|
||||||
window('%s.path' % window_prop, window_path)
|
window('%s.path' % window_prop, window_path)
|
||||||
window('%s.type' % window_prop, view['Media'])
|
window('%s.type' % window_prop, view['Media'])
|
||||||
|
self.window_artwork(window_prop, view['Id'])
|
||||||
|
|
||||||
|
def window_artwork(self, prop, view_id):
|
||||||
|
|
||||||
if self.server['connected']:
|
if self.server['connected']:
|
||||||
|
|
||||||
artwork = api.API(None, self.server['auth/server-address']).get_artwork(view['Id'], 'Primary')
|
if self.media_folders is None:
|
||||||
window('%s.artwork' % window_prop, artwork)
|
self.media_folders = self.server['api'].get_media_folders()['Items']
|
||||||
|
|
||||||
|
for library in self.media_folders:
|
||||||
|
|
||||||
|
if library['Id'] == view_id and 'Primary' in library.get('ImageTags', {}):
|
||||||
|
|
||||||
|
artwork = api.API(None, self.server['auth/server-address']).get_artwork(view_id, 'Primary')
|
||||||
|
window('%s.artwork' % prop, artwork)
|
||||||
|
|
||||||
|
break
|
||||||
|
|
||||||
def window_path(self, view, node):
|
def window_path(self, view, node):
|
||||||
return "library://video/emby%s%s/%s.xml" % (view['Media'], view['Id'], node)
|
return "library://video/emby%s%s/%s.xml" % (view['Media'], view['Id'], node)
|
||||||
|
|
Loading…
Reference in a new issue