Merge branch 'fix/cast-not-available-parentId-method' into fix/cast-not-available-mediaType-scrapper-parentTrail

This commit is contained in:
GrégoireDruant 2023-05-07 01:42:26 +02:00
commit 7031a3e98f
5 changed files with 51 additions and 3 deletions

View file

@ -77,6 +77,9 @@ class Kodi(object):
except TypeError:
return
def update_path_parent_id(self, path_id, parent_path_id):
self.cursor.execute(QU.update_path_parent_id, (parent_path_id, path_id))
def update_path(self, *args):
self.cursor.execute(QU.update_path, args)

View file

@ -334,17 +334,22 @@ VALUES (?, ?, ?)
"""
add_episode = """
INSERT INTO episode(idEpisode, idFile, c00, c01, c03, c04, c05, c09, c10, c12, c13, c14,
idShow, c15, c16, idSeason)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
idShow, c15, c16, idSeason, c18, c20)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
"""
add_episode_obj = ["{EpisodeId}", "{FileId}", "{Title}", "{Plot}", "{RatingId}", "{Writers}", "{Premiere}", "{Runtime}",
"{Directors}", "{Season}", "{Index}", "{Title}", "{ShowId}", "{AirsBeforeSeason}",
"{AirsBeforeEpisode}", "{SeasonId}"]
"{AirsBeforeEpisode}", "{SeasonId}", "{Filename}", "{Unique}"]
add_art = """
INSERT INTO art(media_id, media_type, type, url)
VALUES (?, ?, ?, ?)
"""
update_path_parent_id = """
UPDATE path
SET idParentPath = ?
where idPath = ?
"""
update_path = """
UPDATE path

View file

@ -177,6 +177,9 @@ class TVShows(KodiDb):
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'])
# TODO: Greg
self.update_path_parent_id(obj['PathId'], obj['TopPathId'])
def tvshow_update(self, obj):
''' Update object to kodi.
@ -187,10 +190,15 @@ class TVShows(KodiDb):
obj['Unique'] = self.get_unique_id(*values(obj, QU.get_unique_id_tvshow_obj))
self.update_unique_id(*values(obj, QU.update_unique_id_tvshow_obj))
obj['TopPathId'] = self.get_path(obj['TopLevel'])
self.update(*values(obj, QU.update_tvshow_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'])
# TODO: Greg
self.update_path_parent_id(obj['PathId'], obj['TopPathId'])
def get_path_filename(self, obj):
''' Get the path and build it into protocol://path
@ -259,6 +267,9 @@ class TVShows(KodiDb):
obj = self.objects.map(item, 'Episode')
update = True
LOG.debug("EPISODE item: [%s]", item)
LOG.debug("EPISODE e_item: [%s]", e_item)
if obj['Location'] == "Virtual":
LOG.info("Skipping virtual episode %s: %s", obj['Title'], obj['Id'])
@ -377,6 +388,12 @@ class TVShows(KodiDb):
return self.episode_add(obj)
self.jellyfin_db.add_reference(*values(obj, QUEM.add_reference_episode_obj))
# TODO Greg
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)
LOG.debug("ADD episode [%s/%s] %s: %s", obj['PathId'], obj['FileId'], obj['Id'], obj['Title'])
def episode_update(self, obj):