Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix movie database for Kodi 21 #831

Merged
merged 2 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion jellyfin_kodi/objects/kodi/movies.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,23 @@ def get(self, *args):
def add(self, *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):
self.cursor.execute(QU.update_movie, args)

def delete(self, kodi_id, file_id):

self.cursor.execute(QU.delete_movie, (kodi_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):

Expand Down Expand Up @@ -130,4 +140,4 @@ def remove_from_boxset(self, *args):
self.cursor.execute(QU.delete_movie_set, args)

def delete_boxset(self, *args):
self.cursor.execute(QU.delete_set, args)
self.cursor.execute(QU.delete_set, args)
12 changes: 12 additions & 0 deletions jellyfin_kodi/objects/kodi/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,14 @@
VALUES (?, ?)
"""
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 = """
INSERT INTO musicvideo(idMVideo, idFile, c00, c04, c05, c06, c07, c08, c09, c10,
c11, c12, premiered)
Expand Down Expand Up @@ -530,6 +538,10 @@
WHERE idMovie = ?
"""
delete_movie_obj = ["{KodiId}", "{FileId}"]
delete_video_version = """
DELETE FROM videoversion
WHERE idFile = ?
"""
delete_set = """
DELETE FROM sets
WHERE idSet = ?
Expand Down
1 change: 1 addition & 0 deletions jellyfin_kodi/objects/movies.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ def movie_add(self, obj):
obj['FileId'] = self.add_file(*values(obj, QU.add_file_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))
LOG.debug("ADD movie [%s/%s/%s] %s: %s", obj['PathId'], obj['FileId'], obj['MovieId'], obj['Id'], obj['Title'])

Expand Down
Loading