Fix content type for dynamic music

This commit is contained in:
angelblue05 2018-10-05 01:39:49 -05:00
parent c42dddf563
commit 90ed66bc56

View file

@ -244,12 +244,14 @@ def browse(media, view_id=None, folder=None, server_id=None):
content_type = "files" content_type = "files"
if media in ('tvshows', 'seasons', 'episodes', 'movies', 'musicvideos'): if media in ('tvshows', 'seasons', 'episodes', 'movies', 'musicvideos', 'songs', 'albums'):
content_type = media content_type = media
elif media in ('homevideos', 'photos'): elif media in ('homevideos', 'photos'):
content_type = "images" content_type = "images"
elif media in ('books', 'audiobooks'): elif media in ('books', 'audiobooks'):
content_type = "videos" content_type = "videos"
elif media == 'music':
content_type = "artists"
if folder == 'recentlyadded': if folder == 'recentlyadded':
@ -288,6 +290,8 @@ def browse(media, view_id=None, folder=None, server_id=None):
listing = TheVoid('Browse', {'Id': folder or view_id, 'ServerId': server_id, 'Recursive': True, 'Media': get_media_type(content_type)}).get() listing = TheVoid('Browse', {'Id': folder or view_id, 'ServerId': server_id, 'Recursive': True, 'Media': get_media_type(content_type)}).get()
elif media == 'seasons': elif media == 'seasons':
listing = TheVoid('BrowseSeason', {'Id': folder, 'ServerId': server_id}).get() listing = TheVoid('BrowseSeason', {'Id': folder, 'ServerId': server_id}).get()
elif media != 'files':
listing = TheVoid('Browse', {'Id': folder or view_id, 'ServerId': server_id, 'Recursive': False, 'Media': get_media_type(content_type)}).get()
else: else:
listing = TheVoid('Browse', {'Id': folder or view_id, 'ServerId': server_id, 'Recursive': False}).get() listing = TheVoid('Browse', {'Id': folder or view_id, 'ServerId': server_id, 'Recursive': False}).get()
@ -310,7 +314,7 @@ def browse(media, view_id=None, folder=None, server_id=None):
params = { params = {
'id': view_id or item['Id'], 'id': view_id or item['Id'],
'mode': "browse", 'mode': "browse",
'type': get_folder_type(item) or media, 'type': get_folder_type(item, media) or media,
'folder': item['Id'], 'folder': item['Id'],
'server': server_id 'server': server_id
} }
@ -333,7 +337,7 @@ def browse(media, view_id=None, folder=None, server_id=None):
params = { params = {
'id': view_id or item['Id'], 'id': view_id or item['Id'],
'mode': "browse", 'mode': "browse",
'type': get_folder_type(item) or media, 'type': get_folder_type(item, media) or media,
'folder': 'genres-%s' % item['Id'], 'folder': 'genres-%s' % item['Id'],
'server': server_id 'server': server_id
} }
@ -368,6 +372,7 @@ def browse(media, view_id=None, folder=None, server_id=None):
xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_VIDEO_RATING) xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_VIDEO_RATING)
xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_VIDEO_RUNTIME) xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_VIDEO_RUNTIME)
LOG.info(content_type)
xbmcplugin.setContent(int(sys.argv[1]), content_type) xbmcplugin.setContent(int(sys.argv[1]), content_type)
xbmcplugin.endOfDirectory(int(sys.argv[1])) xbmcplugin.endOfDirectory(int(sys.argv[1]))
@ -420,7 +425,7 @@ def browse_letters(media, view_id, server_id=None):
xbmcplugin.setContent(int(sys.argv[1]), 'files') xbmcplugin.setContent(int(sys.argv[1]), 'files')
xbmcplugin.endOfDirectory(int(sys.argv[1])) xbmcplugin.endOfDirectory(int(sys.argv[1]))
def get_folder_type(item): def get_folder_type(item, content_type=None):
media = item['Type'] media = item['Type']
@ -436,6 +441,9 @@ def get_folder_type(item):
return "songs" return "songs"
elif media == 'CollectionFolder': elif media == 'CollectionFolder':
return item.get('CollectionType', 'library') return item.get('CollectionType', 'library')
elif media == 'Folder' and content_type == 'music':
return "albums"
def get_media_type(media): def get_media_type(media):
@ -449,6 +457,8 @@ def get_media_type(media):
return "BoxSet" return "BoxSet"
elif media == 'tvshows': elif media == 'tvshows':
return "Series" return "Series"
elif media == 'music':
return "MusicArtist,MusicAlbum,Audio"
def get_fanart(item_id, path, server_id=None): def get_fanart(item_id, path, server_id=None):