mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
WIP: parent path id
This commit is contained in:
parent
0473c1eb77
commit
1a3f312057
5 changed files with 29 additions and 28 deletions
|
@ -71,19 +71,10 @@ class JellyfinDatabase():
|
||||||
except TypeError:
|
except TypeError:
|
||||||
return
|
return
|
||||||
|
|
||||||
def get_season_kodi_parent_path_id(self, *args):
|
|
||||||
|
|
||||||
try:
|
|
||||||
self.cursor.execute(QU.get_season_kodi_parent_path_id_obj, args)
|
|
||||||
|
|
||||||
return self.cursor.fetchone()[0]
|
|
||||||
except TypeError:
|
|
||||||
return
|
|
||||||
|
|
||||||
def get_episode_kodi_parent_path_id(self, *args):
|
def get_episode_kodi_parent_path_id(self, *args):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.cursor.execute(QU.get_episode_kodi_parent_path_id_obj, args)
|
self.cursor.execute(QU.get_episode_kodi_parent_path_id, args)
|
||||||
|
|
||||||
return self.cursor.fetchone()[0]
|
return self.cursor.fetchone()[0]
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
|
|
@ -166,16 +166,7 @@ WHERE jellyfin_parent_id = ?
|
||||||
delete_version = """
|
delete_version = """
|
||||||
DELETE FROM version
|
DELETE FROM version
|
||||||
"""
|
"""
|
||||||
get_season_kodi_parent_path_id = """
|
|
||||||
SELECT sh.kodi_pathid
|
|
||||||
FROM jellyfin s
|
|
||||||
JOIN jellyfin sh
|
|
||||||
ON s.parent_id = sh.kodi_id
|
|
||||||
WHERE s.media_type = ?
|
|
||||||
AND sh.media_type = ?
|
|
||||||
AND s.id = ?
|
|
||||||
"""
|
|
||||||
get_season_kodi_parent_path_id_obj = ["season", "tvshow", "{SeasonId}"]
|
|
||||||
get_episode_kodi_parent_path_id = """
|
get_episode_kodi_parent_path_id = """
|
||||||
SELECT sh.kodi_pathid
|
SELECT sh.kodi_pathid
|
||||||
FROM jellyfin e
|
FROM jellyfin e
|
||||||
|
@ -183,9 +174,9 @@ JOIN jellyfin s
|
||||||
ON e.parent_id = s.kodi_id
|
ON e.parent_id = s.kodi_id
|
||||||
JOIN jellyfin sh
|
JOIN jellyfin sh
|
||||||
ON s.parent_id = sh.kodi_id
|
ON s.parent_id = sh.kodi_id
|
||||||
WHERE e.media_type = "episode"
|
WHERE e.media_type = ?
|
||||||
AND s.media_type = "season"
|
AND s.media_type = ?
|
||||||
AND sh.media_type = "tvshow"
|
AND sh.media_type = ?
|
||||||
AND e.kodi_fileid = 698;
|
AND e.jellyfin_id = ?;
|
||||||
"""
|
"""
|
||||||
get_episode_kodi_parent_path_id = ["episode", "season", "tvshow", "{EpisodeId}"]
|
get_episode_kodi_parent_path_id_obj = ["episode", "season", "tvshow", "{Id}"]
|
|
@ -77,6 +77,9 @@ class Kodi(object):
|
||||||
except TypeError:
|
except TypeError:
|
||||||
return
|
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):
|
def update_path(self, *args):
|
||||||
self.cursor.execute(QU.update_path, args)
|
self.cursor.execute(QU.update_path, args)
|
||||||
|
|
||||||
|
|
|
@ -345,6 +345,11 @@ INSERT INTO art(media_id, media_type, type, url)
|
||||||
VALUES (?, ?, ?, ?)
|
VALUES (?, ?, ?, ?)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
update_path_parent_id = """
|
||||||
|
UPDATE path
|
||||||
|
SET idParentPath = ?
|
||||||
|
where idPath = ?
|
||||||
|
"""
|
||||||
|
|
||||||
update_path = """
|
update_path = """
|
||||||
UPDATE path
|
UPDATE path
|
||||||
|
|
|
@ -116,7 +116,6 @@ class TVShows(KodiDb):
|
||||||
self.tvshow_add(obj)
|
self.tvshow_add(obj)
|
||||||
|
|
||||||
self.link(*values(obj, QU.update_tvshow_link_obj))
|
self.link(*values(obj, QU.update_tvshow_link_obj))
|
||||||
# Ne marche pas en mode update...
|
|
||||||
self.update_path(*values(obj, QU.update_path_tvshow_obj))
|
self.update_path(*values(obj, QU.update_path_tvshow_obj))
|
||||||
self.add_tags(*values(obj, QU.add_tags_tvshow_obj))
|
self.add_tags(*values(obj, QU.add_tags_tvshow_obj))
|
||||||
self.add_people(*values(obj, QU.add_people_tvshow_obj))
|
self.add_people(*values(obj, QU.add_people_tvshow_obj))
|
||||||
|
@ -153,8 +152,6 @@ class TVShows(KodiDb):
|
||||||
season_id = self.get_season(*values(obj, QU.get_season_special_obj))
|
season_id = self.get_season(*values(obj, QU.get_season_special_obj))
|
||||||
self.artwork.add(obj['Artwork'], season_id, "season")
|
self.artwork.add(obj['Artwork'], season_id, "season")
|
||||||
|
|
||||||
# verifier ici
|
|
||||||
|
|
||||||
for season in season_episodes:
|
for season in season_episodes:
|
||||||
for episodes in server.get_episode_by_season(season_episodes[season], season):
|
for episodes in server.get_episode_by_season(season_episodes[season], season):
|
||||||
|
|
||||||
|
@ -180,6 +177,9 @@ 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'])
|
||||||
|
|
||||||
|
# TODO: Greg
|
||||||
|
self.update_path_parent_id(obj['PathId'], obj['TopPathId'])
|
||||||
|
|
||||||
def tvshow_update(self, obj):
|
def tvshow_update(self, obj):
|
||||||
|
|
||||||
''' Update object to kodi.
|
''' Update object to kodi.
|
||||||
|
@ -190,10 +190,15 @@ class TVShows(KodiDb):
|
||||||
obj['Unique'] = self.get_unique_id(*values(obj, QU.get_unique_id_tvshow_obj))
|
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))
|
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.update(*values(obj, QU.update_tvshow_obj))
|
||||||
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'])
|
||||||
|
|
||||||
|
# TODO: Greg
|
||||||
|
self.update_path_parent_id(obj['PathId'], obj['TopPathId'])
|
||||||
|
|
||||||
def get_path_filename(self, obj):
|
def get_path_filename(self, obj):
|
||||||
|
|
||||||
''' Get the path and build it into protocol://path
|
''' Get the path and build it into protocol://path
|
||||||
|
@ -383,6 +388,12 @@ class TVShows(KodiDb):
|
||||||
return self.episode_add(obj)
|
return self.episode_add(obj)
|
||||||
|
|
||||||
self.jellyfin_db.add_reference(*values(obj, QUEM.add_reference_episode_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'])
|
LOG.debug("ADD episode [%s/%s] %s: %s", obj['PathId'], obj['FileId'], obj['Id'], obj['Title'])
|
||||||
|
|
||||||
def episode_update(self, obj):
|
def episode_update(self, obj):
|
||||||
|
|
Loading…
Reference in a new issue