Hardcode plugin-calls instead of using urlencode

This commit is contained in:
croneter 2018-03-07 08:40:18 +01:00
parent a8ac23e74a
commit 11db94f84f
4 changed files with 20 additions and 43 deletions

View file

@ -2,7 +2,7 @@
############################################################################### ###############################################################################
from logging import getLogger from logging import getLogger
from xbmc import getInfoLabel, sleep, executebuiltin, getCondVisibility from xbmc import getInfoLabel, sleep, executebuiltin
from xbmcaddon import Addon from xbmcaddon import Addon
import plexdb_functions as plexdb import plexdb_functions as plexdb
@ -157,12 +157,8 @@ class ContextMenu(object):
v.KODI_PLAYLIST_TYPE_FROM_KODI_TYPE[self.kodi_type]) v.KODI_PLAYLIST_TYPE_FROM_KODI_TYPE[self.kodi_type])
playqueue.clear() playqueue.clear()
state.CONTEXT_MENU_PLAY = True state.CONTEXT_MENU_PLAY = True
params = { handle = ('plugin://%s/?plex_id=%s&plex_type=%s&mode=play'
'mode': 'play', % (v.ADDON_TYPE[self.plex_type],
'plex_id': self.plex_id, self.plex_id,
'plex_type': self.plex_type self.plex_type))
}
from urllib import urlencode
handle = ("plugin://plugin.video.plexkodiconnect/movies?%s"
% urlencode(params))
executebuiltin('RunPlugin(%s)' % handle) executebuiltin('RunPlugin(%s)' % handle)

View file

@ -562,13 +562,8 @@ def getOnDeck(viewid, mediatype, tagname, limit):
if directpaths: if directpaths:
url = api.file_path() url = api.file_path()
else: else:
params = { url = ('plugin://%s.tvshows/?plex_id=%s&plex_type=%s&mode=play'
'mode': "play", % (v.ADDON_ID, api.plex_id(), api.plex_type()))
'plex_id': api.plex_id(),
'plex_type': api.plex_type()
}
url = "plugin://plugin.video.plexkodiconnect/tvshows/?%s" \
% urlencode(params)
xbmcplugin.addDirectoryItem( xbmcplugin.addDirectoryItem(
handle=HANDLE, handle=HANDLE,
url=url, url=url,
@ -836,12 +831,8 @@ def __build_item(xml_element):
elif api.plex_type() == v.PLEX_TYPE_PHOTO: elif api.plex_type() == v.PLEX_TYPE_PHOTO:
url = api.get_picture_path() url = api.get_picture_path()
else: else:
params = { url = 'plugin://%s/?plex_id=%s&plex_type=%s&mode=play' \
'mode': 'play', % (v.ADDON_TYPE[api.plex_type()], api.plex_id(), api.plex_type())
'plex_id': api.plex_id(),
'plex_type': api.plex_type(),
}
url = "plugin://%s?%s" % (v.ADDON_ID, urlencode(params))
xbmcplugin.addDirectoryItem(handle=HANDLE, xbmcplugin.addDirectoryItem(handle=HANDLE,
url=url, url=url,
listitem=listitem) listitem=listitem)

View file

@ -1,7 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### ###############################################################################
from logging import getLogger from logging import getLogger
from urllib import urlencode
from ntpath import dirname from ntpath import dirname
from datetime import datetime from datetime import datetime
@ -18,6 +17,9 @@ import state
LOG = getLogger("PLEX." + __name__) LOG = getLogger("PLEX." + __name__)
# Note: always use same order of URL arguments, NOT urlencode:
# plex_id=<plex_id>&plex_type=<plex_type>&mode=play
############################################################################### ###############################################################################
@ -284,12 +286,8 @@ class Movies(Items):
if do_indirect: if do_indirect:
# Set plugin path and media flags using real filename # Set plugin path and media flags using real filename
path = 'plugin://%s.movies/' % v.ADDON_ID path = 'plugin://%s.movies/' % v.ADDON_ID
params = { filename = ('%s?plex_id=%s&plex_type=%s&mode=play'
'mode': 'play', % (path, itemid, v.PLEX_TYPE_MOVIE))
'plex_id': itemid,
'plex_type': v.PLEX_TYPE_MOVIE
}
filename = "%s?%s" % (path, urlencode(params))
playurl = filename playurl = filename
# movie table: # movie table:
@ -925,12 +923,8 @@ class TVShows(Items):
# Set plugin path - do NOT use "intermediate" paths for the show # Set plugin path - do NOT use "intermediate" paths for the show
# as with direct paths! # as with direct paths!
path = 'plugin://%s.tvshows/%s/' % (v.ADDON_ID, series_id) path = 'plugin://%s.tvshows/%s/' % (v.ADDON_ID, series_id)
params = { filename = ('%s?plex_id=%s&plex_type=%s&mode=play'
'plex_id': itemid, % (path, itemid, v.PLEX_TYPE_EPISODE))
'plex_type': v.PLEX_TYPE_EPISODE,
'mode': 'play'
}
filename = "%s?%s" % (path, urlencode(params))
playurl = filename playurl = filename
parent_path_id = self.kodi_db.getParentPathId(path) parent_path_id = self.kodi_db.getParentPathId(path)

View file

@ -3,7 +3,6 @@ Used to kick off Kodi playback
""" """
from logging import getLogger from logging import getLogger
from threading import Thread from threading import Thread
from urllib import urlencode
from xbmc import Player, sleep from xbmc import Player, sleep
@ -205,13 +204,10 @@ def _prep_playlist_stack(xml):
api.set_part_number(part) api.set_part_number(part)
if kodi_id is None: if kodi_id is None:
# Need to redirect again to PKC to conclude playback # Need to redirect again to PKC to conclude playback
params = { path = ('plugin://%s/?plex_id=%s&plex_type=%s&mode=play'
'mode': 'play', % (v.ADDON_TYPE[api.plex_type()],
'plex_id': api.plex_id(), api.plex_id(),
'plex_type': api.plex_type() api.plex_type()))
}
path = ('plugin://%s/?%s'
% (v.ADDON_TYPE[api.plex_type()], urlencode(params)))
listitem = api.create_listitem() listitem = api.create_listitem()
listitem.setPath(try_encode(path)) listitem.setPath(try_encode(path))
else: else: