mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-09-18 12:34:39 +00:00
Refactors video version handling for consistency
Retrieves video version item type through a query for setting default values, enhancing flexibility and reducing hardcoding. Replaces static item type in video version insertion with dynamic retrieval, improving maintainability.
This commit is contained in:
parent
bccb376d21
commit
2ca9cf212b
3 changed files with 9 additions and 3 deletions
|
@ -21,6 +21,7 @@ class Movies(Kodi):
|
|||
|
||||
self.cursor = cursor
|
||||
Kodi.__init__(self)
|
||||
self.itemtype = self.cursor.execute(QU.get_videoversion_itemtype, [40400])
|
||||
|
||||
def create_entry_unique_id(self):
|
||||
self.cursor.execute(QU.create_unique_id)
|
||||
|
@ -165,7 +166,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", 40400, 40400)
|
||||
self.add_videoversion(entry[0], entry[1], "movie", self.itemtype, 40400)
|
||||
changes = True
|
||||
|
||||
LOG.info("Omega database migration is complete")
|
||||
|
|
|
@ -409,12 +409,16 @@ VALUES (?, ?)
|
|||
add_set_obj = ["{Title}", "{Overview}"]
|
||||
add_video_version = """
|
||||
INSERT INTO videoversion(idFile, idMedia, media_type, itemType, idType)
|
||||
VALUES (?, ?, ?, (SELECT itemType FROM videoversiontype WHERE id = ?), ?)
|
||||
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", 40400, 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