From 72bfc5dacffc321fc984ef8af94954f53a518dfc Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Tue, 6 May 2025 10:21:40 +0200 Subject: [PATCH] Adds Piers database migration logic Introduces a new migration step for Kodi versions 134 and above by implementing the piers_migration method. This ensures all existing movies without a version receive a standard version, enhancing database consistency. Omega migration logic is now limited to versions between 131 and 133. No additional context provided. --- jellyfin_kodi/objects/kodi/movies.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/jellyfin_kodi/objects/kodi/movies.py b/jellyfin_kodi/objects/kodi/movies.py index 5fe29293..71cbe324 100644 --- a/jellyfin_kodi/objects/kodi/movies.py +++ b/jellyfin_kodi/objects/kodi/movies.py @@ -142,8 +142,11 @@ class Movies(Kodi): # Will run every time Kodi starts, but will be fast enough on # subsequent runs to not be a meaningful delay - if version_id >= 131: + if 131 <= version_id < 134: changes = self.omega_migration() + + if version_id >= 134: + changes = self.piers_migration() return changes @@ -158,8 +161,25 @@ class Movies(Kodi): # Sets all existing movies without a version to standard version for entry in self.cursor.fetchall(): - self.add_videoversion(entry[0], entry[1], "movie", "1", 40400) + self.add_videoversion(entry[0], entry[1], "movie", "0", 40400) changes = True LOG.info("Omega database migration is complete") return changes + + def piers_migration(self): + """ + Adds a video version for all existing movies + """ + LOG.info("Starting migration for Piers database changes") + # Tracks if this migration made any changes + changes = False + self.cursor.execute(QU.get_missing_versions) + + # Sets all existing movies without a version to standard version + for entry in self.cursor.fetchall(): + self.add_videoversion(entry[0], entry[1], "movie", "1", 40400) + changes = True + + LOG.info("Piers database migration is complete") + return changes