diff --git a/resources/lib/context_entry.py b/resources/lib/context_entry.py index 96ea0777..56d2f2b1 100644 --- a/resources/lib/context_entry.py +++ b/resources/lib/context_entry.py @@ -2,7 +2,7 @@ ############################################################################### from logging import getLogger -from xbmc import getInfoLabel, sleep, executebuiltin, getCondVisibility +from xbmc import getInfoLabel, sleep, executebuiltin from xbmcaddon import Addon import plexdb_functions as plexdb @@ -157,12 +157,8 @@ class ContextMenu(object): v.KODI_PLAYLIST_TYPE_FROM_KODI_TYPE[self.kodi_type]) playqueue.clear() state.CONTEXT_MENU_PLAY = True - params = { - 'mode': 'play', - 'plex_id': self.plex_id, - 'plex_type': self.plex_type - } - from urllib import urlencode - handle = ("plugin://plugin.video.plexkodiconnect/movies?%s" - % urlencode(params)) + handle = ('plugin://%s/?plex_id=%s&plex_type=%s&mode=play' + % (v.ADDON_TYPE[self.plex_type], + self.plex_id, + self.plex_type)) executebuiltin('RunPlugin(%s)' % handle) diff --git a/resources/lib/entrypoint.py b/resources/lib/entrypoint.py index 6bb54d2d..c2741eee 100644 --- a/resources/lib/entrypoint.py +++ b/resources/lib/entrypoint.py @@ -562,13 +562,8 @@ def getOnDeck(viewid, mediatype, tagname, limit): if directpaths: url = api.file_path() else: - params = { - 'mode': "play", - 'plex_id': api.plex_id(), - 'plex_type': api.plex_type() - } - url = "plugin://plugin.video.plexkodiconnect/tvshows/?%s" \ - % urlencode(params) + url = ('plugin://%s.tvshows/?plex_id=%s&plex_type=%s&mode=play' + % (v.ADDON_ID, api.plex_id(), api.plex_type())) xbmcplugin.addDirectoryItem( handle=HANDLE, url=url, @@ -836,12 +831,8 @@ def __build_item(xml_element): elif api.plex_type() == v.PLEX_TYPE_PHOTO: url = api.get_picture_path() else: - params = { - 'mode': 'play', - 'plex_id': api.plex_id(), - 'plex_type': api.plex_type(), - } - url = "plugin://%s?%s" % (v.ADDON_ID, urlencode(params)) + url = 'plugin://%s/?plex_id=%s&plex_type=%s&mode=play' \ + % (v.ADDON_TYPE[api.plex_type()], api.plex_id(), api.plex_type()) xbmcplugin.addDirectoryItem(handle=HANDLE, url=url, listitem=listitem) diff --git a/resources/lib/itemtypes.py b/resources/lib/itemtypes.py index 410066e5..6b465bc7 100644 --- a/resources/lib/itemtypes.py +++ b/resources/lib/itemtypes.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################### from logging import getLogger -from urllib import urlencode from ntpath import dirname from datetime import datetime @@ -18,6 +17,9 @@ import state LOG = getLogger("PLEX." + __name__) +# Note: always use same order of URL arguments, NOT urlencode: +# plex_id=&plex_type=&mode=play + ############################################################################### @@ -284,12 +286,8 @@ class Movies(Items): if do_indirect: # Set plugin path and media flags using real filename path = 'plugin://%s.movies/' % v.ADDON_ID - params = { - 'mode': 'play', - 'plex_id': itemid, - 'plex_type': v.PLEX_TYPE_MOVIE - } - filename = "%s?%s" % (path, urlencode(params)) + filename = ('%s?plex_id=%s&plex_type=%s&mode=play' + % (path, itemid, v.PLEX_TYPE_MOVIE)) playurl = filename # movie table: @@ -925,12 +923,8 @@ class TVShows(Items): # Set plugin path - do NOT use "intermediate" paths for the show # as with direct paths! path = 'plugin://%s.tvshows/%s/' % (v.ADDON_ID, series_id) - params = { - 'plex_id': itemid, - 'plex_type': v.PLEX_TYPE_EPISODE, - 'mode': 'play' - } - filename = "%s?%s" % (path, urlencode(params)) + filename = ('%s?plex_id=%s&plex_type=%s&mode=play' + % (path, itemid, v.PLEX_TYPE_EPISODE)) playurl = filename parent_path_id = self.kodi_db.getParentPathId(path) diff --git a/resources/lib/playback.py b/resources/lib/playback.py index 7c481ad5..a0723a9d 100644 --- a/resources/lib/playback.py +++ b/resources/lib/playback.py @@ -3,7 +3,6 @@ Used to kick off Kodi playback """ from logging import getLogger from threading import Thread -from urllib import urlencode from xbmc import Player, sleep @@ -205,13 +204,10 @@ def _prep_playlist_stack(xml): api.set_part_number(part) if kodi_id is None: # Need to redirect again to PKC to conclude playback - params = { - 'mode': 'play', - 'plex_id': api.plex_id(), - 'plex_type': api.plex_type() - } - path = ('plugin://%s/?%s' - % (v.ADDON_TYPE[api.plex_type()], urlencode(params))) + path = ('plugin://%s/?plex_id=%s&plex_type=%s&mode=play' + % (v.ADDON_TYPE[api.plex_type()], + api.plex_id(), + api.plex_type())) listitem = api.create_listitem() listitem.setPath(try_encode(path)) else: