mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-09-18 12:34:39 +00:00
Merge pull request #993 from JeroenED/JeroenED-patch-no-movies
Fix movies sync for Kodi 22 Piers
This commit is contained in:
commit
1447061201
3 changed files with 30 additions and 2 deletions
|
@ -1,6 +1,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import division, absolute_import, print_function, unicode_literals
|
||||
|
||||
from sqlite3 import DatabaseError
|
||||
|
||||
##################################################################################################
|
||||
|
||||
from ...helper import LazyLogger
|
||||
|
@ -17,10 +19,18 @@ LOG = LazyLogger(__name__)
|
|||
|
||||
class Movies(Kodi):
|
||||
|
||||
itemtype: int
|
||||
|
||||
def __init__(self, cursor):
|
||||
|
||||
self.cursor = cursor
|
||||
Kodi.__init__(self)
|
||||
try:
|
||||
self.cursor.execute(QU.get_videoversion_itemtype, [40400])
|
||||
self.itemtype = self.cursor.fetchone()[0]
|
||||
except (IndexError, DatabaseError, TypeError) as e:
|
||||
LOG.warning("Unable to fetch videoversion itemtype: %s", e)
|
||||
self.itemtype = 0
|
||||
|
||||
def create_entry_unique_id(self):
|
||||
self.cursor.execute(QU.create_unique_id)
|
||||
|
@ -150,6 +160,13 @@ class Movies(Kodi):
|
|||
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
|
||||
|
@ -158,7 +175,7 @@ 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", "0", 40400)
|
||||
self.add_videoversion(entry[0], entry[1], "movie", self.itemtype, 40400)
|
||||
changes = True
|
||||
|
||||
LOG.info("Omega database migration is complete")
|
||||
|
|
|
@ -411,10 +411,20 @@ add_video_version = """
|
|||
INSERT INTO videoversion(idFile, idMedia, media_type, itemType, idType)
|
||||
VALUES (?, ?, ?, ?, ?)
|
||||
"""
|
||||
add_video_version_obj = [
|
||||
"{FileId}",
|
||||
"{MovieId}",
|
||||
"movie",
|
||||
"{VideoVersionItemType}",
|
||||
40400,
|
||||
]
|
||||
get_videoversion_itemtype = """
|
||||
SELECT itemType FROM videoversiontype WHERE id = ?
|
||||
"""
|
||||
get_videoversion_itemtype_obj = ["{VideoVersionId}"]
|
||||
check_video_version = """
|
||||
SELECT COUNT(name) FROM sqlite_master WHERE type='table' AND name='videoversion'
|
||||
"""
|
||||
add_video_version_obj = ["{FileId}", "{MovieId}", "movie", "0", 40400]
|
||||
add_musicvideo = """
|
||||
INSERT INTO musicvideo(idMVideo, idFile, c00, c04, c05, c06, c07, c08, c09, c10,
|
||||
c11, c12, premiered)
|
||||
|
|
|
@ -156,6 +156,7 @@ class Movies(KodiDb):
|
|||
|
||||
obj["PathId"] = self.add_path(*values(obj, QU.add_path_obj))
|
||||
obj["FileId"] = self.add_file(*values(obj, QU.add_file_obj))
|
||||
obj["VideoVersionItemType"] = self.itemtype
|
||||
|
||||
self.add(*values(obj, QU.add_movie_obj))
|
||||
self.add_videoversion(*values(obj, QU.add_video_version_obj))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue