Addon paths: Don't store show id in path

This commit is contained in:
croneter 2018-03-18 13:48:29 +01:00
parent c54da58d87
commit 7096aa35b2

View file

@ -836,7 +836,7 @@ class TVShows(Items):
# GET THE FILE AND PATH ##### # GET THE FILE AND PATH #####
if state.DIRECT_PATHS: if state.DIRECT_PATHS:
playurl = api.file_path(force_first_media=True) playurl = api.file_path(force_first_media=True)
playurl = api.validate_playurl(playurl, api.plex_type()) playurl = api.validate_playurl(playurl, v.PLEX_TYPE_EPISODE)
if playurl is None: if playurl is None:
return False return False
if "\\" in playurl: if "\\" in playurl:
@ -847,19 +847,20 @@ class TVShows(Items):
filename = playurl.rsplit("/", 1)[1] filename = playurl.rsplit("/", 1)[1]
path = playurl.replace(filename, "") path = playurl.replace(filename, "")
parent_path_id = self.kodi_db.parent_path_id(path) parent_path_id = self.kodi_db.parent_path_id(path)
pathid = self.kodi_db.add_video_path(path,
id_parent_path=parent_path_id)
else: else:
# 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/' % v.ADDON_ID
filename = ('%s?plex_id=%s&plex_type=%s&mode=play' filename = ('%s?plex_id=%s&plex_type=%s&mode=play'
% (path, itemid, v.PLEX_TYPE_EPISODE)) % (path, itemid, v.PLEX_TYPE_EPISODE))
playurl = filename playurl = filename
parent_path_id = self.kodi_db.parent_path_id(path) # Root path tvshows/ already saved in Kodi DB
pathid = self.kodi_db.add_video_path(path)
# add/retrieve pathid and fileid # add/retrieve pathid and fileid
# if the path or file already exists, the calls return current value # if the path or file already exists, the calls return current value
pathid = self.kodi_db.add_video_path(path,
id_parent_path=parent_path_id)
fileid = self.kodi_db.add_file(filename, pathid, dateadded) fileid = self.kodi_db.add_file(filename, pathid, dateadded)
# UPDATE THE EPISODE ##### # UPDATE THE EPISODE #####