From 7f21c6175316e138a0d46802c901221994aa1f81 Mon Sep 17 00:00:00 2001 From: im85288 Date: Fri, 24 Jul 2015 12:29:41 +0100 Subject: [PATCH] support for kodi jarvis --- resources/lib/Utils.py | 6 ++++++ resources/lib/WriteKodiMusicDB.py | 6 +++--- resources/lib/WriteKodiVideoDB.py | 18 +++++++++--------- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/resources/lib/Utils.py b/resources/lib/Utils.py index eb89ba8f..3606ab45 100644 --- a/resources/lib/Utils.py +++ b/resources/lib/Utils.py @@ -76,6 +76,9 @@ def getKodiVideoDBPath(): elif kodibuild.startswith("15"): # Isengard dbVersion = "93" + elif kodibuild.startswith("16"): + # Jarvis + dbVersion = "94" else: # Not a compatible build xbmc.log("This Kodi version is incompatible. Current version: %s" % kodibuild) @@ -94,6 +97,9 @@ def getKodiMusicDBPath(): elif xbmc.getInfoLabel("System.BuildVersion").startswith("15"): #isengard dbVersion = "52" + elif xbmc.getInfoLabel("System.BuildVersion").startswith("16"): + #jarvis + dbVersion = "53" else: # Not a compatible build xbmc.log("This Kodi version is incompatible. Current version: %s" % kodibuild) diff --git a/resources/lib/WriteKodiMusicDB.py b/resources/lib/WriteKodiMusicDB.py index 802a1028..4da1cf7d 100644 --- a/resources/lib/WriteKodiMusicDB.py +++ b/resources/lib/WriteKodiMusicDB.py @@ -163,7 +163,7 @@ class WriteKodiMusicDB(): if albumid: self.logMsg("UPDATE album to Kodi library, Id: %s - Title: %s" % (embyId, name), 1) - if kodiVersion == 15: + if kodiVersion == 15 or kodiVersion == 16: # Kodi Isengard query = "UPDATE album SET strAlbum = ?, strMusicBrainzAlbumID = ?, strArtists = ?, iYear = ?, strGenres = ?, strReview = ?, strImage = ?, lastScraped = ?, dateAdded = ?, strReleaseType = ? WHERE idAlbum = ?" cursor.execute(query, (name, musicBrainzId, artists, year, genre, bio, thumb, lastScraped, dateadded, "album", albumid)) @@ -188,7 +188,7 @@ class WriteKodiMusicDB(): # Create the album cursor.execute("select coalesce(max(idAlbum),0) as albumid from album") albumid = cursor.fetchone()[0] + 1 - if kodiVersion == 15: + if kodiVersion == 15 or kodiVersion == 16: # Kodi Isengard query = "INSERT INTO album(idAlbum, strAlbum, strMusicBrainzAlbumID, strArtists, iYear, strGenres, strReview, strImage, lastScraped, dateAdded, strReleaseType) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" cursor.execute(query, (albumid, name, musicBrainzId, artists, year, genre, bio, thumb, lastScraped, dateadded, "album")) @@ -299,7 +299,7 @@ class WriteKodiMusicDB(): # No album found, create a single's album cursor.execute("select coalesce(max(idAlbum),0) as albumid from album") albumid = cursor.fetchone()[0] + 1 - if kodiVersion == 15: + if kodiVersion == 15 or kodiVersion == 16: # Kodi Isengard query = "INSERT INTO album(idAlbum, strArtists, strGenres, iYear, dateAdded, strReleaseType) values(?, ?, ?, ?, ?, ?)" cursor.execute(query, (albumid, artists, genre, year, dateadded, "single")) diff --git a/resources/lib/WriteKodiVideoDB.py b/resources/lib/WriteKodiVideoDB.py index a0c4de93..c1205e42 100644 --- a/resources/lib/WriteKodiVideoDB.py +++ b/resources/lib/WriteKodiVideoDB.py @@ -831,8 +831,8 @@ class WriteKodiVideoDB(): name = person['Name'] type = person['Type'] - if kodiVersion == 15: - # Kodi Isengard + if kodiVersion == 15 or kodiVersion == 16: + # Kodi Isengard/jarvis cursor.execute("SELECT actor_id as actorid FROM actor WHERE name = ?", (name,)) else: # Kodi Gotham or Helix @@ -842,7 +842,7 @@ class WriteKodiVideoDB(): actorid = cursor.fetchone()[0] except: # Person entry does not exist yet. - if kodiVersion == 15: + if kodiVersion == 15 or kodiVersion == 16: # Kodi Isengard cursor.execute("select coalesce(max(actor_id),0) as actorid from actor") query = "INSERT INTO actor(actor_id, name) values(?, ?)" @@ -867,7 +867,7 @@ class WriteKodiVideoDB(): self.addOrUpdateArt(thumb, actorid, arttype, "thumb", cursor) # Link person to content in database - if kodiVersion == 15: + if kodiVersion == 15 or kodiVersion == 16: # Kodi Isengard if "Actor" in type: Role = person.get('Role') @@ -927,7 +927,7 @@ class WriteKodiVideoDB(): if genres: # Delete current genres for clean slate - if kodiVersion == 15: + if kodiVersion == 15 or kodiVersion == 16: cursor.execute("DELETE FROM genre_link WHERE media_id = ? AND media_type = ?", (id, mediatype,)) else: if "movie" in mediatype: @@ -940,7 +940,7 @@ class WriteKodiVideoDB(): # Add Genres for genre in genres: - if kodiVersion == 15: + if kodiVersion == 15 or kodiVersion == 16: # Kodi Isengard cursor.execute("SELECT genre_id as genre_id FROM genre WHERE name = ?", (genre,)) try: @@ -987,7 +987,7 @@ class WriteKodiVideoDB(): if countries: for country in countries: - if kodiVersion == 15: + if kodiVersion == 15 or kodiVersion == 16: # Kodi Isengard cursor.execute("SELECT country_id as country_id FROM country WHERE name = ?", (country,)) try: @@ -1029,7 +1029,7 @@ class WriteKodiVideoDB(): if studios: for studio in studios: - if kodiVersion == 15: + if kodiVersion == 15 or kodiVersion == 16: # Kodi Isengard cursor.execute("SELECT studio_id as studio_id FROM studio WHERE name = ?",(studio,)) try: @@ -1076,7 +1076,7 @@ class WriteKodiVideoDB(): if tag: - if kodiVersion == 15: + if kodiVersion == 15 or kodiVersion == 16: # Kodi Isengard cursor.execute("SELECT tag_id as tag_id FROM tag WHERE name = ?", (tag,)) try: