Merge pull request #925 from croneter/fix-directories

Provide more metadata for unsynced directory-like items like a tv show
This commit is contained in:
croneter 2019-07-13 16:16:36 +02:00 committed by GitHub
commit 7c5c91b590
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -79,7 +79,6 @@ def generate_item(api):
def _generate_folder(api):
'''Generates "folder"/"directory" items that user can further navigate'''
art = api.artwork()
typus = ''
if api.plex_type == v.PLEX_TYPE_GENRE:
# Unfortunately, 'genre' is not yet supported by Kodi
@ -95,23 +94,34 @@ def _generate_folder(api):
typus = v.KODI_TYPE_ALBUM
elif api.fast_key and '?collection=' in api.fast_key:
typus = v.KODI_TYPE_SET
return {
'title': api.title(),
'label': api.title(),
'file': api.directory_path(section_id=SECTION_ID,
plex_type=PLEX_TYPE,
old_key=KEY),
'icon': 'DefaultFolder.png',
'art': {
'thumb': art['thumb'] if 'thumb' in art else
(art['poster'] if 'poster' in art else
'special://home/addons/%s/icon.png' % v.ADDON_ID),
'fanart': art['fanart'] if 'fanart' in art else
'special://home/addons/%s/fanart.jpg' % v.ADDON_ID},
'isFolder': True,
'type': typus,
'IsPlayable': 'false',
}
if typus and typus != v.KODI_TYPE_SET:
content = _generate_content(api)
content['type'] = typus
content['file'] = api.directory_path(section_id=SECTION_ID,
plex_type=PLEX_TYPE,
old_key=KEY)
content['isFolder'] = True
content['IsPlayable'] = 'false'
return content
else:
art = api.artwork()
return {
'title': api.title(),
'label': api.title(),
'file': api.directory_path(section_id=SECTION_ID,
plex_type=PLEX_TYPE,
old_key=KEY),
'icon': 'DefaultFolder.png',
'art': {
'thumb': art['thumb'] if 'thumb' in art else
(art['poster'] if 'poster' in art else
'special://home/addons/%s/icon.png' % v.ADDON_ID),
'fanart': art['fanart'] if 'fanart' in art else
'special://home/addons/%s/fanart.jpg' % v.ADDON_ID},
'isFolder': True,
'type': typus,
'IsPlayable': 'false',
}
def _generate_content(api):