Addon paths: include real filename in plugin calls

This commit is contained in:
croneter 2018-03-18 14:50:37 +01:00
parent 7096aa35b2
commit 6fcbf29779

View file

@ -288,9 +288,16 @@ class Movies(Items):
scraper='metadata.local')
if do_indirect:
# Set plugin path and media flags using real filename
filename = api.file_path(force_first_media=True)
if "\\" in filename:
# Local path
filename = filename.rsplit("\\", 1)[1]
else:
# Network share
filename = filename.rsplit("/", 1)[1]
path = 'plugin://%s.movies/' % v.ADDON_ID
filename = ('%s?plex_id=%s&plex_type=%s&mode=play'
% (path, itemid, v.PLEX_TYPE_MOVIE))
filename = ('%s?plex_id=%s&plex_type=%s&mode=play&filename=%s'
% (path, itemid, v.PLEX_TYPE_MOVIE, filename))
playurl = filename
pathid = self.kodi_db.get_path(path)
@ -837,8 +844,6 @@ class TVShows(Items):
if state.DIRECT_PATHS:
playurl = api.file_path(force_first_media=True)
playurl = api.validate_playurl(playurl, v.PLEX_TYPE_EPISODE)
if playurl is None:
return False
if "\\" in playurl:
# Local path
filename = playurl.rsplit("\\", 1)[1]
@ -852,9 +857,16 @@ class TVShows(Items):
else:
# Set plugin path - do NOT use "intermediate" paths for the show
# as with direct paths!
filename = api.file_path(force_first_media=True)
if "\\" in filename:
# Local path
filename = filename.rsplit("\\", 1)[1]
else:
# Network share
filename = filename.rsplit("/", 1)[1]
path = 'plugin://%s.tvshows/' % v.ADDON_ID
filename = ('%s?plex_id=%s&plex_type=%s&mode=play'
% (path, itemid, v.PLEX_TYPE_EPISODE))
filename = ('%s?plex_id=%s&plex_type=%s&mode=play&filename=%s'
% (path, itemid, v.PLEX_TYPE_EPISODE, filename))
playurl = filename
# Root path tvshows/ already saved in Kodi DB
pathid = self.kodi_db.add_video_path(path)