mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-26 10:46:11 +00:00
support new jarvis version of music db 54
This commit is contained in:
parent
c92454bb92
commit
b0592d3b02
2 changed files with 26 additions and 9 deletions
|
@ -100,7 +100,7 @@ def getKodiMusicDBPath():
|
||||||
dbVersion = "52"
|
dbVersion = "52"
|
||||||
elif xbmc.getInfoLabel("System.BuildVersion").startswith("16"):
|
elif xbmc.getInfoLabel("System.BuildVersion").startswith("16"):
|
||||||
#jarvis
|
#jarvis
|
||||||
dbVersion = "53"
|
dbVersion = "54"
|
||||||
else:
|
else:
|
||||||
# Not a compatible build
|
# Not a compatible build
|
||||||
xbmc.log("This Kodi version is incompatible. Current version: %s" % kodibuild)
|
xbmc.log("This Kodi version is incompatible. Current version: %s" % kodibuild)
|
||||||
|
|
|
@ -44,7 +44,7 @@ class WriteKodiMusicDB():
|
||||||
|
|
||||||
# If the item already exist in the local Kodi DB we'll perform a full item update
|
# If the item already exist in the local Kodi DB we'll perform a full item update
|
||||||
# If the item doesn't exist, we'll add it to the database
|
# If the item doesn't exist, we'll add it to the database
|
||||||
|
kodiVersion = self.kodiversion
|
||||||
embyId = MBitem["Id"]
|
embyId = MBitem["Id"]
|
||||||
|
|
||||||
cursor.execute("SELECT kodi_id FROM emby WHERE emby_id = ?", (embyId,))
|
cursor.execute("SELECT kodi_id FROM emby WHERE emby_id = ?", (embyId,))
|
||||||
|
@ -75,6 +75,10 @@ class WriteKodiMusicDB():
|
||||||
if artistid:
|
if artistid:
|
||||||
self.logMsg("UPDATE artist to Kodi library, Id: %s - Artist: %s" % (embyId, name), 1)
|
self.logMsg("UPDATE artist to Kodi library, Id: %s - Artist: %s" % (embyId, name), 1)
|
||||||
|
|
||||||
|
if kodiVersion == 16:
|
||||||
|
query = "UPDATE artist SET strArtist = ?, strMusicBrainzArtistID = ?, strGenres = ?, strBiography = ?, strImage = ?, strFanart = ?, lastScraped = ? WHERE idArtist = ?"
|
||||||
|
cursor.execute(query, (name, musicBrainzId, genres, bio, thumb, fanart, lastScraped, artistid))
|
||||||
|
else:
|
||||||
query = "UPDATE artist SET strArtist = ?, strMusicBrainzArtistID = ?, strGenres = ?, strBiography = ?, strImage = ?, strFanart = ?, lastScraped = ?, dateadded = ? WHERE idArtist = ?"
|
query = "UPDATE artist SET strArtist = ?, strMusicBrainzArtistID = ?, strGenres = ?, strBiography = ?, strImage = ?, strFanart = ?, lastScraped = ?, dateadded = ? WHERE idArtist = ?"
|
||||||
cursor.execute(query, (name, musicBrainzId, genres, bio, thumb, fanart, lastScraped, dateadded, artistid))
|
cursor.execute(query, (name, musicBrainzId, genres, bio, thumb, fanart, lastScraped, dateadded, artistid))
|
||||||
|
|
||||||
|
@ -106,6 +110,10 @@ class WriteKodiMusicDB():
|
||||||
# Create the artist
|
# Create the artist
|
||||||
cursor.execute("select coalesce(max(idArtist),0) as artistid from artist")
|
cursor.execute("select coalesce(max(idArtist),0) as artistid from artist")
|
||||||
artistid = cursor.fetchone()[0] + 1
|
artistid = cursor.fetchone()[0] + 1
|
||||||
|
if kodiVersion == 16:
|
||||||
|
query = "INSERT INTO artist(idArtist, strArtist, strMusicBrainzArtistID, strGenres, strBiography, strImage, strFanart, lastScraped) values(?, ?, ?, ?, ?, ?, ?, ?)"
|
||||||
|
cursor.execute(query, (artistid, name, musicBrainzId, genres, bio, thumb, fanart, lastScraped))
|
||||||
|
else:
|
||||||
query = "INSERT INTO artist(idArtist, strArtist, strMusicBrainzArtistID, strGenres, strBiography, strImage, strFanart, lastScraped, dateAdded) values(?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
query = "INSERT INTO artist(idArtist, strArtist, strMusicBrainzArtistID, strGenres, strBiography, strImage, strFanart, lastScraped, dateAdded) values(?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
||||||
cursor.execute(query, (artistid, name, musicBrainzId, genres, bio, thumb, fanart, lastScraped, dateadded))
|
cursor.execute(query, (artistid, name, musicBrainzId, genres, bio, thumb, fanart, lastScraped, dateadded))
|
||||||
|
|
||||||
|
@ -167,10 +175,13 @@ class WriteKodiMusicDB():
|
||||||
if albumid:
|
if albumid:
|
||||||
self.logMsg("UPDATE album to Kodi library, Id: %s - Title: %s" % (embyId, name), 1)
|
self.logMsg("UPDATE album to Kodi library, Id: %s - Title: %s" % (embyId, name), 1)
|
||||||
|
|
||||||
if kodiVersion == 15 or kodiVersion == 16:
|
if kodiVersion == 15:
|
||||||
# Kodi Isengard
|
# Kodi Isengard
|
||||||
query = "UPDATE album SET strAlbum = ?, strMusicBrainzAlbumID = ?, strArtists = ?, iYear = ?, strGenres = ?, strReview = ?, strImage = ?, lastScraped = ?, dateAdded = ?, strReleaseType = ? WHERE idAlbum = ?"
|
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))
|
cursor.execute(query, (name, musicBrainzId, artists, year, genre, bio, thumb, lastScraped, dateadded, "album", albumid))
|
||||||
|
elif kodiVersion == 16:
|
||||||
|
query = "UPDATE album SET strAlbum = ?, strMusicBrainzAlbumID = ?, strArtists = ?, iYear = ?, strGenres = ?, strReview = ?, strImage = ?, lastScraped = ?, strReleaseType = ? WHERE idAlbum = ?"
|
||||||
|
cursor.execute(query, (name, musicBrainzId, artists, year, genre, bio, thumb, lastScraped, "album", albumid))
|
||||||
else:
|
else:
|
||||||
# Kodi Gotham and Helix
|
# Kodi Gotham and Helix
|
||||||
query = "UPDATE album SET strAlbum = ?, strMusicBrainzAlbumID = ?, strArtists = ?, iYear = ?, strGenres = ?, strReview = ?, strImage = ?, lastScraped = ?, dateAdded = ? WHERE idAlbum = ?"
|
query = "UPDATE album SET strAlbum = ?, strMusicBrainzAlbumID = ?, strArtists = ?, iYear = ?, strGenres = ?, strReview = ?, strImage = ?, lastScraped = ?, dateAdded = ? WHERE idAlbum = ?"
|
||||||
|
@ -192,10 +203,13 @@ class WriteKodiMusicDB():
|
||||||
# Create the album
|
# Create the album
|
||||||
cursor.execute("select coalesce(max(idAlbum),0) as albumid from album")
|
cursor.execute("select coalesce(max(idAlbum),0) as albumid from album")
|
||||||
albumid = cursor.fetchone()[0] + 1
|
albumid = cursor.fetchone()[0] + 1
|
||||||
if kodiVersion == 15 or kodiVersion == 16:
|
if kodiVersion == 15:
|
||||||
# Kodi Isengard
|
# Kodi Isengard
|
||||||
query = "INSERT INTO album(idAlbum, strAlbum, strMusicBrainzAlbumID, strArtists, iYear, strGenres, strReview, strImage, lastScraped, dateAdded, strReleaseType) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
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"))
|
cursor.execute(query, (albumid, name, musicBrainzId, artists, year, genre, bio, thumb, lastScraped, dateadded, "album"))
|
||||||
|
elif kodiVersion == 16:
|
||||||
|
query = "INSERT INTO album(idAlbum, strAlbum, strMusicBrainzAlbumID, strArtists, iYear, strGenres, strReview, strImage, lastScraped, strReleaseType) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
||||||
|
cursor.execute(query, (albumid, name, musicBrainzId, artists, year, genre, bio, thumb, lastScraped, "album"))
|
||||||
else:
|
else:
|
||||||
# Kodi Gotham and Helix
|
# Kodi Gotham and Helix
|
||||||
query = "INSERT INTO album(idAlbum, strAlbum, strMusicBrainzAlbumID, strArtists, iYear, strGenres, strReview, strImage, lastScraped, dateAdded) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
query = "INSERT INTO album(idAlbum, strAlbum, strMusicBrainzAlbumID, strArtists, iYear, strGenres, strReview, strImage, lastScraped, dateAdded) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
||||||
|
@ -308,10 +322,13 @@ class WriteKodiMusicDB():
|
||||||
# No album found, create a single's album
|
# No album found, create a single's album
|
||||||
cursor.execute("select coalesce(max(idAlbum),0) as albumid from album")
|
cursor.execute("select coalesce(max(idAlbum),0) as albumid from album")
|
||||||
albumid = cursor.fetchone()[0] + 1
|
albumid = cursor.fetchone()[0] + 1
|
||||||
if kodiVersion == 15 or kodiVersion == 16:
|
if kodiVersion == 15:
|
||||||
# Kodi Isengard
|
# Kodi Isengard
|
||||||
query = "INSERT INTO album(idAlbum, strArtists, strGenres, iYear, dateAdded, strReleaseType) values(?, ?, ?, ?, ?, ?)"
|
query = "INSERT INTO album(idAlbum, strArtists, strGenres, iYear, dateAdded, strReleaseType) values(?, ?, ?, ?, ?, ?)"
|
||||||
cursor.execute(query, (albumid, artists, genre, year, dateadded, "single"))
|
cursor.execute(query, (albumid, artists, genre, year, dateadded, "single"))
|
||||||
|
elif kodiVersion == 16:
|
||||||
|
query = "INSERT INTO album(idAlbum, strArtists, strGenres, iYear, strReleaseType) values(?, ?, ?, ?, ?)"
|
||||||
|
cursor.execute(query, (albumid, artists, genre, year, "single"))
|
||||||
else:
|
else:
|
||||||
# Kodi Gotham and Helix
|
# Kodi Gotham and Helix
|
||||||
query = "INSERT INTO album(idAlbum, strArtists, strGenres, iYear, dateAdded) values(?, ?, ?, ?, ?)"
|
query = "INSERT INTO album(idAlbum, strArtists, strGenres, iYear, dateAdded) values(?, ?, ?, ?, ?)"
|
||||||
|
|
Loading…
Reference in a new issue