Enable webservice playback for shows

This commit is contained in:
croneter 2019-04-07 12:02:39 +02:00
parent d7541b7f74
commit 20bffc1b41
2 changed files with 20 additions and 16 deletions

View file

@ -180,7 +180,8 @@ class Show(TvShowMixin, ItemBase):
scraper='metadata.local') scraper='metadata.local')
else: else:
# Set plugin path # Set plugin path
toplevelpath = "plugin://%s.tvshows/" % v.ADDON_ID toplevelpath = ('http://127.0.0.1:%s/plex/kodi/shows/'
% v.WEBSERVICE_PORT)
path = "%s%s/" % (toplevelpath, plex_id) path = "%s%s/" % (toplevelpath, plex_id)
# Do NOT set a parent id because addon-path cannot be "stacked" # Do NOT set a parent id because addon-path cannot be "stacked"
toppathid = None toppathid = None
@ -448,22 +449,25 @@ class Episode(TvShowMixin, ItemBase):
if do_indirect: if do_indirect:
# 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!
filename = api.file_name(force_first_media=True) # Set plugin path and media flags using real filename
path = 'plugin://%s.tvshows/%s/' % (v.ADDON_ID, show_id) path = ('http://127.0.0.1:%s/plex/kodi/shows/%s/'
filename = ('%s?plex_id=%s&plex_type=%s&mode=play&filename=%s' % (v.WEBSERVICE_PORT, show_id))
% (path, plex_id, v.PLEX_TYPE_EPISODE, filename)) filename = '{0}/file.strm?kodi_id={1}&kodi_type={2}&plex_id={0}&plex_type={3}'
filename = filename.format(plex_id,
kodi_id,
v.KODI_TYPE_EPISODE,
v.PLEX_TYPE_EPISODE)
playurl = filename playurl = filename
# Root path tvshows/ already saved in Kodi DB # Root path tvshows/ already saved in Kodi DB
kodi_pathid = self.kodidb.add_path(path) kodi_pathid = self.kodidb.get_path(path)
if not app.SYNC.direct_paths: # HACK
# need to set a 2nd file entry for a path without plex show id # need to set a 2nd file entry for a path without plex show id
# This fixes e.g. context menu and widgets working as they # This fixes e.g. context menu and widgets working as they
# should # should
# A dirty hack, really path_2 = 'http://127.0.0.1:%s/plex/kodi/shows/' % v.WEBSERVICE_PORT
path_2 = 'plugin://%s.tvshows/' % v.ADDON_ID # filename_2 is exactly the same as filename
# filename_2 is exactly the same as filename # so WITH plex show id!
# so WITH plex show id! kodi_pathid_2 = self.kodidb.add_path(path_2)
kodi_pathid_2 = self.kodidb.add_path(path_2)
# UPDATE THE EPISODE ##### # UPDATE THE EPISODE #####
if update_item: if update_item:

View file

@ -10,7 +10,7 @@ from .. import path_ops, timing, variables as v
LOG = getLogger('PLEX.kodi_db.video') LOG = getLogger('PLEX.kodi_db.video')
MOVIE_PATH = 'http://127.0.0.1:%s/plex/kodi/movies/' % v.WEBSERVICE_PORT MOVIE_PATH = 'http://127.0.0.1:%s/plex/kodi/movies/' % v.WEBSERVICE_PORT
SHOW_PATH = 'plugin://%s.tvshows/' % v.ADDON_ID SHOW_PATH = 'http://127.0.0.1:%s/plex/kodi/shows/' % v.WEBSERVICE_PORT
class KodiVideoDB(common.KodiDBBase): class KodiVideoDB(common.KodiDBBase):