From 7096aa35b2c70a28ccf9b3de515c1eca9c579ca8 Mon Sep 17 00:00:00 2001 From: croneter Date: Sun, 18 Mar 2018 13:48:29 +0100 Subject: [PATCH] Addon paths: Don't store show id in path --- resources/lib/itemtypes.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/resources/lib/itemtypes.py b/resources/lib/itemtypes.py index 0d315e34..04ce41ac 100644 --- a/resources/lib/itemtypes.py +++ b/resources/lib/itemtypes.py @@ -836,7 +836,7 @@ class TVShows(Items): # GET THE FILE AND PATH ##### if state.DIRECT_PATHS: 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: return False if "\\" in playurl: @@ -847,19 +847,20 @@ class TVShows(Items): filename = playurl.rsplit("/", 1)[1] path = playurl.replace(filename, "") 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: # 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) + path = 'plugin://%s.tvshows/' % v.ADDON_ID filename = ('%s?plex_id=%s&plex_type=%s&mode=play' % (path, itemid, v.PLEX_TYPE_EPISODE)) 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 # 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) # UPDATE THE EPISODE #####