Merge branch 'fix/cast-not-availaible-addon-mode-ugly-hack'

This commit is contained in:
GrégoireDruant 2023-05-13 17:45:13 +02:00
commit 4f448e772f
2 changed files with 21 additions and 4 deletions

View file

@ -358,6 +358,7 @@ WHERE idPath = ?
""" """
update_path_movie_obj = ["{Path}", "movies", "metadata.local", 1, "{PathId}"] update_path_movie_obj = ["{Path}", "movies", "metadata.local", 1, "{PathId}"]
update_path_toptvshow_obj = ["{TopLevel}", "tvshows", "metadata.local", 1, "{TopPathId}"] 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_tvshow_obj = ["{Path}", None, None, 1, "{PathId}"]
update_path_episode_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}"] update_path_mvideo_obj = ["{Path}", "musicvideos", "metadata.local", 1, "{PathId}"]

View file

@ -169,7 +169,19 @@ class TVShows(KodiDb):
self.add_unique_id(*values(obj, QU.add_unique_id_tvshow_obj)) self.add_unique_id(*values(obj, QU.add_unique_id_tvshow_obj))
obj['TopPathId'] = self.add_path(obj['TopLevel']) obj['TopPathId'] = self.add_path(obj['TopLevel'])
if self.direct_path:
# Normal way, we use the actual top path
self.update_path(*values(obj, QU.update_path_toptvshow_obj)) 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)) obj['PathId'] = self.add_path(*values(obj, QU.get_path_obj))
@ -388,6 +400,7 @@ class TVShows(KodiDb):
self.jellyfin_db.add_reference(*values(obj, QUEM.add_reference_episode_obj)) 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)) parentPathId = self.jellyfin_db.get_episode_kodi_parent_path_id(*values(obj, QUEM.get_episode_kodi_parent_path_id_obj))
if obj['PathId'] != parentPathId:
LOG.debug("Setting episode pathParentId, episode %s, title %s, pathId %s, pathParentId %s", obj['Id'], obj['Title'], 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) self.update_path_parent_id(obj['PathId'], parentPathId)
@ -440,7 +453,10 @@ class TVShows(KodiDb):
obj['FullFilePath'] = obj['Path'] + obj['Filename'] obj['FullFilePath'] = obj['Path'] + obj['Filename']
else: else:
obj['Path'] = "plugin://plugin.video.jellyfin/%s/" % obj['SeriesId'] # We need LibraryId
library = self.library or find_library(self.server, obj)
obj['LibraryId'] = library['Id']
obj['Path'] = "plugin://plugin.video.jellyfin/%s/%s/" % (obj['LibraryId'], obj['SeriesId'])
params = { params = {
'filename': py2_encode(obj['Filename'], 'utf-8'), 'filename': py2_encode(obj['Filename'], 'utf-8'),
'id': obj['Id'], 'id': obj['Id'],