From 5eafcbafb191fae194732871a85283df7c04713e Mon Sep 17 00:00:00 2001 From: croneter Date: Mon, 30 Jul 2018 13:20:40 +0200 Subject: [PATCH] Move PKC playlist shortcut --- default.py | 2 +- resources/lib/entrypoint.py | 12 +++++++++--- resources/lib/videonodes.py | 17 ++--------------- 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/default.py b/default.py index 614d37e3..0539a838 100644 --- a/default.py +++ b/default.py @@ -137,7 +137,7 @@ class Main(): entrypoint.get_video_files(plexId, params) elif mode == 'playlists': - entrypoint.playlists(params.get('type')) + entrypoint.playlists(params.get('content_type')) elif mode == 'hub': entrypoint.hub(params.get('type')) diff --git a/resources/lib/entrypoint.py b/resources/lib/entrypoint.py index 3f8747db..a3d67371 100644 --- a/resources/lib/entrypoint.py +++ b/resources/lib/entrypoint.py @@ -152,6 +152,11 @@ def show_main_menu(content_type=None): 'homevideos', 'musicvideos') and content_type == 'video': directory_item(label, path) + # Playlists + if content_type != 'image': + directory_item(utils.lang(136), + ('plugin://%s?mode=playlists&content_type=%s' + % (v.ADDON_ID, content_type))) # Plex Hub directory_item('Plex Hub', 'plugin://%s?mode=hub&type=%s' % (v.ADDON_ID, content_type)) @@ -676,11 +681,12 @@ def on_deck_episodes(viewid, tagname, limit): xbmcplugin.endOfDirectory(handle=int(argv[1])) -def playlists(plex_playlist_type): +def playlists(content_type): """ Lists all Plex playlists of the media type plex_playlist_type + content_type: 'audio', 'video' """ - LOG.debug('Listing Plex %s playlists', plex_playlist_type) + LOG.debug('Listing Plex %s playlists', content_type) if not _wait_for_auth(): return xbmcplugin.setContent(int(argv[1]), 'files') @@ -690,7 +696,7 @@ def playlists(plex_playlist_type): return for item in xml: api = API(item) - if not api.playlist_type() == plex_playlist_type: + if not api.playlist_type() == content_type: continue listitem = ListItem(api.title()) listitem.setArt({'thumb': api.one_artwork('composite')}) diff --git a/resources/lib/videonodes.py b/resources/lib/videonodes.py index c19a68c0..36c46501 100644 --- a/resources/lib/videonodes.py +++ b/resources/lib/videonodes.py @@ -137,7 +137,6 @@ class VideoNodes(object): '11': "recommended", '12': "ondeck", '13': 'browsefiles', - '14': 'playlists' } mediatypes = { # label according to nodetype per mediatype @@ -153,7 +152,6 @@ class VideoNodes(object): '11': 30230, '12': 39500, '13': 39702, - '14': 136 }, 'tvshows': @@ -169,7 +167,6 @@ class VideoNodes(object): # '11': 30230, '12': 39500, '13': 39702, - '14': 136 }, 'homevideos': @@ -205,7 +202,6 @@ class VideoNodes(object): '2': 517, # Recently played albums '2': 359, # Recently added albums '13': 39702, # browse by folder - '14': 136 # Playlists } } @@ -224,7 +220,6 @@ class VideoNodes(object): '11': '5', # "recommended", '12': '1', # "ondeck" '13': '9', # browse by folder - '14': '10' # Playlists } nodes = mediatypes[mediatype] @@ -270,12 +265,6 @@ class VideoNodes(object): nodetype = 'inprogress' elif nodetype == 'browsefiles': path = 'plugin://plugin.video.plexkodiconnect?mode=browseplex&key=/library/sections/%s/folder' % viewid - elif nodetype == 'playlists': - path = 'plugin://plugin.video.plexkodiconnect?mode=playlists' - if mediatype in ('movies', 'tvshows', 'homevideos'): - path += '&type=%s' % v.PLEX_TYPE_VIDEO_PLAYLIST - else: - path += '&type=%s' % v.PLEX_TYPE_AUDIO_PLAYLIST else: path = "library://video/Plex-%s/%s_%s.xml" % (dirname, viewid, nodetype) @@ -320,8 +309,7 @@ class VideoNodes(object): if (nodetype in ("nextepisodes", "ondeck", 'recentepisodes', - 'browsefiles', - 'playlists') or mediatype == "homevideos"): + 'browsefiles') or mediatype == "homevideos"): # Folder type with plugin path root = self.commonRoot(order=sortorder[node], label=label, @@ -340,8 +328,7 @@ class VideoNodes(object): if (nodetype in ("nextepisodes", "ondeck", 'recentepisodes', - 'browsefiles', - 'playlists') or mediatype == "homevideos"): + 'browsefiles') or mediatype == "homevideos"): etree.SubElement(root, 'path').text = path else: # Elements per nodetype