Fix for movielist (movie_view) on Kodi 21b3 (with videoversions).

Compatible to Kodi <21b3.
This commit is contained in:
[kwa:m] 2024-02-26 19:45:37 +01:00
parent 2e6eff9fb3
commit e45b964f8c
3 changed files with 24 additions and 1 deletions

View file

@ -48,6 +48,11 @@ class Movies(Kodi):
def add(self, *args): def add(self, *args):
self.cursor.execute(QU.add_movie, args) self.cursor.execute(QU.add_movie, args)
def add_videoversion(self, *args):
self.cursor.execute(QU.check_video_version)
if self.cursor.fetchone()[0]==1 :
self.cursor.execute(QU.add_video_version, args)
def update(self, *args): def update(self, *args):
self.cursor.execute(QU.update_movie, args) self.cursor.execute(QU.update_movie, args)
@ -55,6 +60,11 @@ class Movies(Kodi):
self.cursor.execute(QU.delete_movie, (kodi_id,)) self.cursor.execute(QU.delete_movie, (kodi_id,))
self.cursor.execute(QU.delete_file, (file_id,)) self.cursor.execute(QU.delete_file, (file_id,))
self.cursor.execute(QU.check_video_version)
if self.cursor.fetchone()[0]==1 :
self.cursor.execute(QU.delete_video_version, (file_id,))
def get_rating_id(self, *args): def get_rating_id(self, *args):

View file

@ -315,6 +315,14 @@ INSERT INTO sets(strSet, strOverview)
VALUES (?, ?) VALUES (?, ?)
""" """
add_set_obj = ["{Title}", "{Overview}"] add_set_obj = ["{Title}", "{Overview}"]
add_video_version = """
INSERT INTO videoversion(idFile, idMedia, media_type, itemType, idType)
VALUES (?, ?, ?, ?, ?)
"""
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 = """ add_musicvideo = """
INSERT INTO musicvideo(idMVideo, idFile, c00, c04, c05, c06, c07, c08, c09, c10, INSERT INTO musicvideo(idMVideo, idFile, c00, c04, c05, c06, c07, c08, c09, c10,
c11, c12, premiered) c11, c12, premiered)
@ -530,6 +538,10 @@ DELETE FROM movie
WHERE idMovie = ? WHERE idMovie = ?
""" """
delete_movie_obj = ["{KodiId}", "{FileId}"] delete_movie_obj = ["{KodiId}", "{FileId}"]
delete_video_version = """
DELETE FROM videoversion
WHERE idFile = ?
"""
delete_set = """ delete_set = """
DELETE FROM sets DELETE FROM sets
WHERE idSet = ? WHERE idSet = ?

View file

@ -143,6 +143,7 @@ class Movies(KodiDb):
obj['FileId'] = self.add_file(*values(obj, QU.add_file_obj)) obj['FileId'] = self.add_file(*values(obj, QU.add_file_obj))
self.add(*values(obj, QU.add_movie_obj)) self.add(*values(obj, QU.add_movie_obj))
self.add_videoversion(*values(obj, QU.add_video_version_obj))
self.jellyfin_db.add_reference(*values(obj, QUEM.add_reference_movie_obj)) self.jellyfin_db.add_reference(*values(obj, QUEM.add_reference_movie_obj))
LOG.debug("ADD movie [%s/%s/%s] %s: %s", obj['PathId'], obj['FileId'], obj['MovieId'], obj['Id'], obj['Title']) LOG.debug("ADD movie [%s/%s/%s] %s: %s", obj['PathId'], obj['FileId'], obj['MovieId'], obj['Id'], obj['Title'])