Set parent pathId only when in native mode

Also do not set content and scrapper from path not being top paths
This commit is contained in:
GrégoireDruant 2023-05-07 12:28:18 +02:00
parent 5b14abb53f
commit ff95157315
2 changed files with 13 additions and 7 deletions

View file

@ -358,8 +358,8 @@ 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_tvshow_obj = ["{Path}", "tvshows", "metadata.local", 1, "{PathId}"] update_path_tvshow_obj = ["{Path}", None, None, 1, "{PathId}"]
update_path_episode_obj = ["{Path}", "tvshows", "metadata.local", 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}"]
update_file = """ update_file = """

View file

@ -177,6 +177,7 @@ class TVShows(KodiDb):
self.jellyfin_db.add_reference(*values(obj, QUEM.add_reference_tvshow_obj)) self.jellyfin_db.add_reference(*values(obj, QUEM.add_reference_tvshow_obj))
LOG.debug("ADD tvshow [%s/%s/%s] %s: %s", obj['TopPathId'], obj['PathId'], obj['ShowId'], obj['Title'], obj['Id']) LOG.debug("ADD tvshow [%s/%s/%s] %s: %s", obj['TopPathId'], obj['PathId'], obj['ShowId'], obj['Title'], obj['Id'])
if self.direct_path:
self.update_path_parent_id(obj['PathId'], obj['TopPathId']) self.update_path_parent_id(obj['PathId'], obj['TopPathId'])
def tvshow_update(self, obj): def tvshow_update(self, obj):
@ -195,6 +196,7 @@ class TVShows(KodiDb):
self.jellyfin_db.update_reference(*values(obj, QUEM.update_reference_obj)) self.jellyfin_db.update_reference(*values(obj, QUEM.update_reference_obj))
LOG.debug("UPDATE tvshow [%s/%s] %s: %s", obj['PathId'], obj['ShowId'], obj['Title'], obj['Id']) LOG.debug("UPDATE tvshow [%s/%s] %s: %s", obj['PathId'], obj['ShowId'], obj['Title'], obj['Id'])
if self.direct_path:
self.update_path_parent_id(obj['PathId'], obj['TopPathId']) self.update_path_parent_id(obj['PathId'], obj['TopPathId'])
def get_path_filename(self, obj): def get_path_filename(self, obj):
@ -206,6 +208,9 @@ class TVShows(KodiDb):
if '\\' in obj['Path']: if '\\' in obj['Path']:
obj['Path'] = "%s\\" % obj['Path'] obj['Path'] = "%s\\" % obj['Path']
obj['TopLevel'] = "%s\\" % dirname(dirname(obj['Path'])) obj['TopLevel'] = "%s\\" % dirname(dirname(obj['Path']))
elif 'smb://' in obj['Path'] or 'nfs://' in obj['Path']:
obj['Path'] = "%s/" % obj['Path']
obj['TopLevel'] = "%s/" % dirname(dirname(obj['Path']))
else: else:
obj['Path'] = "%s/" % obj['Path'] obj['Path'] = "%s/" % obj['Path']
obj['TopLevel'] = "plugin://plugin.video.jellyfin/" obj['TopLevel'] = "plugin://plugin.video.jellyfin/"
@ -387,6 +392,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))
if self.direct_path:
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))
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)