From e8188cacb141b2f1b045522993356554997d6160 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goireDruant?= Date: Sun, 7 May 2023 16:31:14 +0200 Subject: [PATCH 1/3] WIP add-on mode Context menus are working again Still no cast information Issue with idParentPath to fix tvshow path to check --- jellyfin_kodi/objects/tvshows.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/jellyfin_kodi/objects/tvshows.py b/jellyfin_kodi/objects/tvshows.py index ac445df0..fcef66fa 100644 --- a/jellyfin_kodi/objects/tvshows.py +++ b/jellyfin_kodi/objects/tvshows.py @@ -201,6 +201,8 @@ class TVShows(KodiDb): ''' Get the path and build it into protocol://path ''' + LOG.debug("get_path_filename: path is [%s]", obj['Path']) + if self.direct_path: if '\\' in obj['Path']: @@ -217,7 +219,11 @@ class TVShows(KodiDb): raise PathValidationException("Failed to validate path. User stopped.") else: obj['TopLevel'] = "plugin://plugin.video.jellyfin/%s/" % obj['LibraryId'] - obj['Path'] = "%s%s/" % (obj['TopLevel'], obj['Id']) + # TV Show path is not containing the collection id aka toplevel + # obj['Path'] = "%s%s/" % (obj['TopLevel'], obj['Id']) + obj['Path'] = "plugin://plugin.video.jellyfin/%s/" % obj['Id'] + + LOG.debug("get_path_filename AFTER: path is [%s]", obj['Path']) @stop def season(self, item, show_id=None): From a7e2060c5c681998c058a6047c5e82e26c60350f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goireDruant?= Date: Sun, 7 May 2023 16:44:36 +0200 Subject: [PATCH 2/3] Fix idParentPath addon mode --- jellyfin_kodi/objects/tvshows.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jellyfin_kodi/objects/tvshows.py b/jellyfin_kodi/objects/tvshows.py index fcef66fa..ecd34a14 100644 --- a/jellyfin_kodi/objects/tvshows.py +++ b/jellyfin_kodi/objects/tvshows.py @@ -394,8 +394,9 @@ class TVShows(KodiDb): self.jellyfin_db.add_reference(*values(obj, QUEM.add_reference_episode_obj)) parentPathId = self.jellyfin_db.get_episode_kodi_parent_path_id(*values(obj, QUEM.get_episode_kodi_parent_path_id_obj)) - LOG.debug("Setting episode pathParentId, episode %s, title %s, pathId %s, pathParentId %s", obj['Id'], obj['Title'], obj['PathId'], parentPathId) - self.update_path_parent_id(obj['PathId'], parentPathId) + if obj['PathId'] != parentPathId: + LOG.debug("Setting episode pathParentId, episode %s, title %s, pathId %s, pathParentId %s", obj['Id'], obj['Title'], obj['PathId'], parentPathId) + self.update_path_parent_id(obj['PathId'], parentPathId) LOG.debug("ADD episode [%s/%s] %s: %s", obj['PathId'], obj['FileId'], obj['Id'], obj['Title']) From a8f2935790649dc7f6dce81037d7fcec52f83ead Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goireDruant?= Date: Sun, 7 May 2023 20:18:20 +0200 Subject: [PATCH 3/3] Fix add-on mode. Hacky, to be tested --- jellyfin_kodi/objects/kodi/queries.py | 1 + jellyfin_kodi/objects/tvshows.py | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/jellyfin_kodi/objects/kodi/queries.py b/jellyfin_kodi/objects/kodi/queries.py index e9f1f7c9..940b07bd 100644 --- a/jellyfin_kodi/objects/kodi/queries.py +++ b/jellyfin_kodi/objects/kodi/queries.py @@ -358,6 +358,7 @@ WHERE idPath = ? """ update_path_movie_obj = ["{Path}", "movies", "metadata.local", 1, "{PathId}"] update_path_toptvshow_obj = ["{TopLevel}", "tvshows", "metadata.local", 1, "{TopPathId}"] +update_path_toptvshow_addon_obj = ["{TopLevel}", None, None, 1, "{TopPathId}"] update_path_tvshow_obj = ["{Path}", None, None, 1, "{PathId}"] update_path_episode_obj = ["{Path}", None, None, 1, "{PathId}"] update_path_mvideo_obj = ["{Path}", "musicvideos", "metadata.local", 1, "{PathId}"] diff --git a/jellyfin_kodi/objects/tvshows.py b/jellyfin_kodi/objects/tvshows.py index ecd34a14..99a7ead6 100644 --- a/jellyfin_kodi/objects/tvshows.py +++ b/jellyfin_kodi/objects/tvshows.py @@ -169,7 +169,19 @@ class TVShows(KodiDb): self.add_unique_id(*values(obj, QU.add_unique_id_tvshow_obj)) obj['TopPathId'] = self.add_path(obj['TopLevel']) - self.update_path(*values(obj, QU.update_path_toptvshow_obj)) + + if self.direct_path: + # Normal way, we use the actual top path + self.update_path(*values(obj, QU.update_path_toptvshow_obj)) + else: + # Hack to allow cast information in add-on mode + # We create a path on top of all others that holds mediaType and scrapper + self.update_path(*values(obj, QU.update_path_toptvshow_addon_obj)) + temp_obj = dict() + temp_obj['TopLevel'] = 'plugin://plugin.video.jellyfin/' + temp_obj['TopPathId'] = self.add_path(temp_obj['TopLevel']) + self.update_path(*values(temp_obj, QU.update_path_toptvshow_obj)) + self.update_path_parent_id(obj['TopPathId'], temp_obj['TopPathId']) obj['PathId'] = self.add_path(*values(obj, QU.get_path_obj))