mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-09-18 12:34:39 +00:00
Simplifies movie version migration logic
Consolidates migration logic to handle versions >= 131, eliminating redundant checks for version ranges. Clarifies version assignment for Omega and Piers migrations, ensuring database migrations align with Kodi's automatic behaviors. Improves code maintainability and reduces duplication.
This commit is contained in:
parent
170d5b2b9d
commit
bccb376d21
1 changed files with 9 additions and 22 deletions
|
@ -142,44 +142,31 @@ class Movies(Kodi):
|
|||
|
||||
# Will run every time Kodi starts, but will be fast enough on
|
||||
# subsequent runs to not be a meaningful delay
|
||||
if 131 <= version_id < 134:
|
||||
if version_id >= 131:
|
||||
changes = self.omega_migration()
|
||||
|
||||
if version_id >= 134:
|
||||
changes = self.piers_migration()
|
||||
|
||||
return changes
|
||||
|
||||
def omega_migration(self):
|
||||
"""
|
||||
Adds a video version for all existing movies
|
||||
|
||||
For Omega: video_version_id = 0
|
||||
For Piers: video_version_id = 1
|
||||
|
||||
Migration from Nexus to Omega adds video version with id 0
|
||||
Migration from Nexus to Peirs adds video version with id 1
|
||||
Migration from Omega to Piers this does nothing and is handled by kodi itself
|
||||
"""
|
||||
LOG.info("Starting migration for Omega 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", "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", 40400, 40400)
|
||||
changes = True
|
||||
|
||||
LOG.info("Piers database migration is complete")
|
||||
LOG.info("Omega database migration is complete")
|
||||
return changes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue