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] 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))