fixes for music sync
This commit is contained in:
parent
f7605802d3
commit
46918b914e
5 changed files with 69 additions and 56 deletions
|
@ -433,17 +433,26 @@ class API():
|
||||||
if(data.get("ImageTags") != None and data.get("ImageTags").get(type) != None):
|
if(data.get("ImageTags") != None and data.get("ImageTags").get(type) != None):
|
||||||
imageTag = data.get("ImageTags").get(type)
|
imageTag = data.get("ImageTags").get(type)
|
||||||
|
|
||||||
if (data.get("Type") == "Episode" or data.get("Type") == "Season" or data.get("Type") == "MusicAlbum" or data.get("Type") == "Audio") and type=="Logo":
|
if (data.get("Type") == "Episode" or data.get("Type") == "Season") and type=="Logo":
|
||||||
imageTag = data.get("ParentLogoImageTag")
|
imageTag = data.get("ParentLogoImageTag")
|
||||||
if (data.get("Type") == "Episode" or data.get("Type") == "Season") and type=="Art":
|
if (data.get("Type") == "Episode" or data.get("Type") == "Season") and type=="Art":
|
||||||
imageTag = data.get("ParentArtImageTag")
|
imageTag = data.get("ParentArtImageTag")
|
||||||
if (data.get("Type") == "Episode") and originalType=="Thumb3":
|
if (data.get("Type") == "Episode" and originalType=="Thumb3"):
|
||||||
imageTag = data.get("SeriesThumbImageTag")
|
imageTag = data.get("SeriesThumbImageTag")
|
||||||
if (data.get("Type") == "Season") and originalType=="Thumb3" and imageTag=="e3ab56fe27d389446754d0fb04910a34" :
|
if (data.get("Type") == "Season" and originalType=="Thumb3" and imageTag=="e3ab56fe27d389446754d0fb04910a34"):
|
||||||
imageTag = data.get("ParentThumbImageTag")
|
imageTag = data.get("ParentThumbImageTag")
|
||||||
id = data.get("SeriesId")
|
id = data.get("SeriesId")
|
||||||
if (data.get("Type") == "MusicAlbum" or data.get("Type") == "Audio") and type=="Backdrop":
|
|
||||||
|
# for music we return the parent art if no image exists
|
||||||
|
if (data.get("Type") == "MusicAlbum" or data.get("Type") == "Audio") and type=="Backdrop" and not data.get("BackdropImageTags"):
|
||||||
|
data["BackdropImageTags"] = data["ParentBackdropImageTags"]
|
||||||
id = data.get("ParentBackdropItemId")
|
id = data.get("ParentBackdropItemId")
|
||||||
|
if (data.get("Type") == "MusicAlbum" or data.get("Type") == "Audio") and type=="Logo" and (not imageTag or imageTag == "e3ab56fe27d389446754d0fb04910a34"):
|
||||||
|
imageTag = data.get("ParentLogoImageTag")
|
||||||
|
id = data.get("ParentLogoItemId")
|
||||||
|
if (data.get("Type") == "MusicAlbum" or data.get("Type") == "Audio") and type=="Art" and (not imageTag or imageTag == "e3ab56fe27d389446754d0fb04910a34"):
|
||||||
|
imageTag = data.get("ParentArtImageTag")
|
||||||
|
id = data.get("ParentArtItemId")
|
||||||
|
|
||||||
query = ""
|
query = ""
|
||||||
maxHeight = "10000"
|
maxHeight = "10000"
|
||||||
|
|
|
@ -396,7 +396,9 @@ class LibrarySync(threading.Thread):
|
||||||
def MusicFullSync(self, connection,cursor, pDialog):
|
def MusicFullSync(self, connection,cursor, pDialog):
|
||||||
|
|
||||||
self.ProcessMusicArtists(connection,cursor,pDialog)
|
self.ProcessMusicArtists(connection,cursor,pDialog)
|
||||||
|
connection.commit()
|
||||||
self.ProcessMusicAlbums(connection,cursor,pDialog)
|
self.ProcessMusicAlbums(connection,cursor,pDialog)
|
||||||
|
connection.commit()
|
||||||
self.ProcessMusicSongs(connection,cursor,pDialog)
|
self.ProcessMusicSongs(connection,cursor,pDialog)
|
||||||
|
|
||||||
### commit all changes to database ###
|
### commit all changes to database ###
|
||||||
|
@ -436,10 +438,10 @@ class LibrarySync(threading.Thread):
|
||||||
kodiSong = kodisong
|
kodiSong = kodisong
|
||||||
|
|
||||||
if kodiSong == None:
|
if kodiSong == None:
|
||||||
WriteKodiMusicDB().addOrUpdateSongToKodiLibrary(item["Id"],connection, cursor)
|
WriteKodiMusicDB().addOrUpdateSongToKodiLibrary(item,connection, cursor)
|
||||||
else:
|
else:
|
||||||
if kodiSong[2] != API().getChecksum(item):
|
if kodiSong[2] != API().getChecksum(item):
|
||||||
WriteKodiMusicDB().addOrUpdateSongToKodiLibrary(item["Id"],connection, cursor)
|
WriteKodiMusicDB().addOrUpdateSongToKodiLibrary(item,connection, cursor)
|
||||||
|
|
||||||
#### PROCESS DELETES #####
|
#### PROCESS DELETES #####
|
||||||
allEmbySongIds = set(allEmbySongIds)
|
allEmbySongIds = set(allEmbySongIds)
|
||||||
|
@ -462,7 +464,7 @@ class LibrarySync(threading.Thread):
|
||||||
total = len(allEmbyArtists) + 1
|
total = len(allEmbyArtists) + 1
|
||||||
count = 1
|
count = 1
|
||||||
|
|
||||||
#### PROCESS SONGS ADDS AND UPDATES ###
|
#### PROCESS ARTIST ADDS AND UPDATES ###
|
||||||
for item in allEmbyArtists:
|
for item in allEmbyArtists:
|
||||||
|
|
||||||
if (self.ShouldStop()):
|
if (self.ShouldStop()):
|
||||||
|
@ -482,10 +484,10 @@ class LibrarySync(threading.Thread):
|
||||||
kodiArtist = kodiartist
|
kodiArtist = kodiartist
|
||||||
|
|
||||||
if kodiArtist == None:
|
if kodiArtist == None:
|
||||||
WriteKodiMusicDB().addOrUpdateArtistToKodiLibrary(item["Id"],connection, cursor)
|
WriteKodiMusicDB().addOrUpdateArtistToKodiLibrary(item,connection, cursor)
|
||||||
else:
|
else:
|
||||||
if kodiArtist[2] != API().getChecksum(item):
|
if kodiArtist[2] != API().getChecksum(item):
|
||||||
WriteKodiMusicDB().addOrUpdateArtistToKodiLibrary(item["Id"],connection, cursor)
|
WriteKodiMusicDB().addOrUpdateArtistToKodiLibrary(item,connection, cursor)
|
||||||
|
|
||||||
#### PROCESS DELETES #####
|
#### PROCESS DELETES #####
|
||||||
allEmbyArtistIds = set(allEmbyArtistIds)
|
allEmbyArtistIds = set(allEmbyArtistIds)
|
||||||
|
@ -528,10 +530,10 @@ class LibrarySync(threading.Thread):
|
||||||
kodiAlbum = kodialbum
|
kodiAlbum = kodialbum
|
||||||
|
|
||||||
if kodiAlbum == None:
|
if kodiAlbum == None:
|
||||||
WriteKodiMusicDB().addOrUpdateAlbumToKodiLibrary(item["Id"],connection, cursor)
|
WriteKodiMusicDB().addOrUpdateAlbumToKodiLibrary(item,connection, cursor)
|
||||||
else:
|
else:
|
||||||
if kodiAlbum[2] != API().getChecksum(item):
|
if kodiAlbum[2] != API().getChecksum(item):
|
||||||
WriteKodiMusicDB().addOrUpdateAlbumToKodiLibrary(item["Id"],connection, cursor)
|
WriteKodiMusicDB().addOrUpdateAlbumToKodiLibrary(item,connection, cursor)
|
||||||
|
|
||||||
#### PROCESS DELETES #####
|
#### PROCESS DELETES #####
|
||||||
allEmbyAlbumIds = set(allEmbyAlbumIds)
|
allEmbyAlbumIds = set(allEmbyAlbumIds)
|
||||||
|
|
|
@ -72,7 +72,7 @@ class ReadEmbyDB():
|
||||||
doUtils = DownloadUtils()
|
doUtils = DownloadUtils()
|
||||||
|
|
||||||
#only get basic info for our sync-compares
|
#only get basic info for our sync-compares
|
||||||
url = "{server}/Artists?Recursive=true&Fields=Etag,CumulativeRunTimeTicks&UserId={UserId}&format=json"
|
url = "{server}/Artists?Recursive=true&Fields=Etag,Path,Genres,SortName,Studios,Writer,ProductionYear,Taglines,CommunityRating,OfficialRating,CumulativeRunTimeTicks,Metascore,AirTime,DateCreated,MediaStreams,People,Overview&UserId={UserId}&format=json"
|
||||||
|
|
||||||
jsonData = doUtils.downloadUrl(url)
|
jsonData = doUtils.downloadUrl(url)
|
||||||
if (jsonData == ""):
|
if (jsonData == ""):
|
||||||
|
@ -97,7 +97,7 @@ class ReadEmbyDB():
|
||||||
doUtils = DownloadUtils()
|
doUtils = DownloadUtils()
|
||||||
|
|
||||||
#only get basic info for our sync-compares
|
#only get basic info for our sync-compares
|
||||||
url = "{server}/mediabrowser/Users/{UserId}/Items?Fields=Name,CumulativeRunTimeTicks,Etag&Recursive=true&IncludeItemTypes=Audio&format=json"
|
url = "{server}/mediabrowser/Users/{UserId}/Items?Fields=Etag,Path,Genres,SortName,Studios,Writer,ProductionYear,Taglines,CommunityRating,OfficialRating,CumulativeRunTimeTicks,Metascore,AirTime,DateCreated,MediaStreams,People,Overview&Recursive=true&IncludeItemTypes=Audio&format=json"
|
||||||
|
|
||||||
jsonData = doUtils.downloadUrl(url)
|
jsonData = doUtils.downloadUrl(url)
|
||||||
if (jsonData == ""):
|
if (jsonData == ""):
|
||||||
|
@ -122,7 +122,7 @@ class ReadEmbyDB():
|
||||||
doUtils = DownloadUtils()
|
doUtils = DownloadUtils()
|
||||||
|
|
||||||
#only get basic info for our sync-compares
|
#only get basic info for our sync-compares
|
||||||
url = "{server}/mediabrowser/Users/{UserId}/Items?Fields=Name,CumulativeRunTimeTicks,Etag&Recursive=true&IncludeItemTypes=MusicAlbum&format=json"
|
url = "{server}/mediabrowser/Users/{UserId}/Items?Fields=Etag,Path,Genres,SortName,Studios,Writer,ProductionYear,Taglines,CommunityRating,OfficialRating,CumulativeRunTimeTicks,Metascore,AirTime,DateCreated,MediaStreams,People,Overview&Recursive=true&IncludeItemTypes=MusicAlbum&format=json"
|
||||||
|
|
||||||
jsonData = doUtils.downloadUrl(url)
|
jsonData = doUtils.downloadUrl(url)
|
||||||
if (jsonData == ""):
|
if (jsonData == ""):
|
||||||
|
|
|
@ -41,15 +41,13 @@ class WriteKodiMusicDB():
|
||||||
className = self.__class__.__name__
|
className = self.__class__.__name__
|
||||||
utils.logMsg("%s %s" % (self.addonName, className), msg, int(lvl))
|
utils.logMsg("%s %s" % (self.addonName, className), msg, int(lvl))
|
||||||
|
|
||||||
def addOrUpdateArtistToKodiLibrary(self, embyId, connection, cursor):
|
def addOrUpdateArtistToKodiLibrary(self, MBitem, connection, cursor):
|
||||||
|
|
||||||
MBitem = ReadEmbyDB().getFullItem(embyId)
|
|
||||||
if not MBitem:
|
|
||||||
self.logMsg("ADD or UPDATE artist to Kodi library FAILED!, Id: %s" %(embyId), 1)
|
|
||||||
return
|
|
||||||
# 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
|
||||||
|
|
||||||
|
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,))
|
||||||
try:
|
try:
|
||||||
artistid = cursor.fetchone()[0]
|
artistid = cursor.fetchone()[0]
|
||||||
|
@ -74,19 +72,6 @@ class WriteKodiMusicDB():
|
||||||
if fanart:
|
if fanart:
|
||||||
fanart = "<fanart>%s</fanart>" % fanart
|
fanart = "<fanart>%s</fanart>" % fanart
|
||||||
|
|
||||||
# Safety check 1: does the artist already exist?
|
|
||||||
cursor.execute("SELECT idArtist FROM artist WHERE strArtist = ?", (name,))
|
|
||||||
try:
|
|
||||||
artistid = cursor.fetchone()[0]
|
|
||||||
except: pass
|
|
||||||
|
|
||||||
# Safety check 2: does the MusicBrainzArtistId already exist?
|
|
||||||
cursor.execute("SELECT idArtist FROM artist WHERE strMusicBrainzArtistID = ?", (musicBrainzId,))
|
|
||||||
try:
|
|
||||||
artistid = cursor.fetchone()[0]
|
|
||||||
except: pass
|
|
||||||
|
|
||||||
|
|
||||||
##### UPDATE THE ARTIST #####
|
##### UPDATE THE ARTIST #####
|
||||||
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)
|
||||||
|
@ -102,11 +87,28 @@ class WriteKodiMusicDB():
|
||||||
else:
|
else:
|
||||||
self.logMsg("ADD artist to Kodi library, Id: %s - Artist: %s" % (embyId, name), 1)
|
self.logMsg("ADD artist to Kodi library, Id: %s - Artist: %s" % (embyId, name), 1)
|
||||||
|
|
||||||
# Create the artist
|
#safety checks: It looks like Emby supports the same artist multiple times in the database while Kodi doesn't allow that. In case that happens we just merge the artist in the Kodi database.
|
||||||
cursor.execute("select coalesce(max(idArtist),0) as artistid from artist")
|
|
||||||
artistid = cursor.fetchone()[0] + 1
|
# Safety check 1: does the artist already exist?
|
||||||
query = "INSERT INTO artist(idArtist, strArtist, strMusicBrainzArtistID, strGenres, strBiography, strImage, strFanart, lastScraped, dateAdded) values(?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
cursor.execute("SELECT idArtist FROM artist WHERE strArtist = ? COLLATE NOCASE", (name,))
|
||||||
cursor.execute(query, (artistid, name, musicBrainzId, genres, bio, thumb, fanart, lastScraped, dateadded))
|
try:
|
||||||
|
artistid = cursor.fetchone()[0]
|
||||||
|
self.logMsg("Artist already exists in Kodi library - appending to existing object, Id: %s - Artist: %s - MusicBrainzId: %s - existing Kodi Id: %s" % (embyId, name, musicBrainzId, str(artistid)), 1)
|
||||||
|
except: pass
|
||||||
|
|
||||||
|
# Safety check 2: does the MusicBrainzArtistId already exist?
|
||||||
|
cursor.execute("SELECT idArtist FROM artist WHERE strMusicBrainzArtistID = ?", (musicBrainzId,))
|
||||||
|
try:
|
||||||
|
artistid = cursor.fetchone()[0]
|
||||||
|
self.logMsg("Artist already exists in Kodi library - appending to existing object, Id: %s - Artist: %s - MusicBrainzId: %s - existing Kodi Id: %s" % (embyId, name, musicBrainzId, str(artistid)), 1)
|
||||||
|
except: pass
|
||||||
|
|
||||||
|
if not artistid:
|
||||||
|
# Create the artist
|
||||||
|
cursor.execute("select coalesce(max(idArtist),0) as artistid from artist")
|
||||||
|
artistid = cursor.fetchone()[0] + 1
|
||||||
|
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))
|
||||||
|
|
||||||
# Create the reference in emby table
|
# Create the reference in emby table
|
||||||
query = "INSERT INTO emby(emby_id, kodi_id, media_type, checksum) values(?, ?, ?, ?)"
|
query = "INSERT INTO emby(emby_id, kodi_id, media_type, checksum) values(?, ?, ?, ?)"
|
||||||
|
@ -123,11 +125,11 @@ class WriteKodiMusicDB():
|
||||||
self.addOrUpdateArt(API().getArtwork(MBitem, "Disc"), artistid, "artist", "discart", cursor)
|
self.addOrUpdateArt(API().getArtwork(MBitem, "Disc"), artistid, "artist", "discart", cursor)
|
||||||
self.addOrUpdateArt(API().getArtwork(MBitem, "Backdrop"), artistid, "artist", "fanart", cursor)
|
self.addOrUpdateArt(API().getArtwork(MBitem, "Backdrop"), artistid, "artist", "fanart", cursor)
|
||||||
|
|
||||||
def addOrUpdateAlbumToKodiLibrary(self, embyId, connection, cursor):
|
def addOrUpdateAlbumToKodiLibrary(self, MBitem, connection, cursor):
|
||||||
|
|
||||||
kodiVersion = self.kodiversion
|
kodiVersion = self.kodiversion
|
||||||
|
|
||||||
MBitem = ReadEmbyDB().getFullItem(embyId)
|
embyId = MBitem["Id"]
|
||||||
|
|
||||||
# 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
|
||||||
|
@ -236,11 +238,11 @@ class WriteKodiMusicDB():
|
||||||
query = "INSERT OR REPLACE INTO discography(idArtist, strAlbum, strYear) values(?, ?, ?)"
|
query = "INSERT OR REPLACE INTO discography(idArtist, strAlbum, strYear) values(?, ?, ?)"
|
||||||
cursor.execute(query, (artistid, name, str(year)))
|
cursor.execute(query, (artistid, name, str(year)))
|
||||||
|
|
||||||
def addOrUpdateSongToKodiLibrary(self, embyId, connection, cursor):
|
def addOrUpdateSongToKodiLibrary(self, MBitem, connection, cursor):
|
||||||
|
|
||||||
kodiVersion = self.kodiversion
|
kodiVersion = self.kodiversion
|
||||||
|
|
||||||
MBitem = ReadEmbyDB().getFullItem(embyId)
|
embyId = MBitem["Id"]
|
||||||
|
|
||||||
# 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
|
||||||
|
@ -430,7 +432,7 @@ class WriteKodiMusicDB():
|
||||||
|
|
||||||
for genre in genres:
|
for genre in genres:
|
||||||
|
|
||||||
cursor.execute("SELECT idGenre as idGenre FROM genre WHERE strGenre = ?", (genre,))
|
cursor.execute("SELECT idGenre as idGenre FROM genre WHERE strGenre = ? COLLATE NOCASE", (genre,))
|
||||||
try:
|
try:
|
||||||
idGenre = cursor.fetchone()[0]
|
idGenre = cursor.fetchone()[0]
|
||||||
except: # Create the genre
|
except: # Create the genre
|
||||||
|
|
|
@ -867,10 +867,10 @@ class WriteKodiVideoDB():
|
||||||
|
|
||||||
if kodiVersion == 15 or kodiVersion == 16:
|
if kodiVersion == 15 or kodiVersion == 16:
|
||||||
# Kodi Isengard/jarvis
|
# Kodi Isengard/jarvis
|
||||||
cursor.execute("SELECT actor_id as actorid FROM actor WHERE name = ?", (name,))
|
cursor.execute("SELECT actor_id as actorid FROM actor WHERE name = ? COLLATE NOCASE", (name,))
|
||||||
else:
|
else:
|
||||||
# Kodi Gotham or Helix
|
# Kodi Gotham or Helix
|
||||||
cursor.execute("SELECT idActor as actorid FROM actors WHERE strActor = ?", (name,))
|
cursor.execute("SELECT idActor as actorid FROM actors WHERE strActor = ? COLLATE NOCASE", (name,))
|
||||||
|
|
||||||
try: # Update person in database
|
try: # Update person in database
|
||||||
actorid = cursor.fetchone()[0]
|
actorid = cursor.fetchone()[0]
|
||||||
|
@ -977,7 +977,7 @@ class WriteKodiVideoDB():
|
||||||
|
|
||||||
if kodiVersion == 15 or kodiVersion == 16:
|
if kodiVersion == 15 or kodiVersion == 16:
|
||||||
# Kodi Isengard
|
# Kodi Isengard
|
||||||
cursor.execute("SELECT genre_id as genre_id FROM genre WHERE name = ?", (genre,))
|
cursor.execute("SELECT genre_id as genre_id FROM genre WHERE name = ? COLLATE NOCASE", (genre,))
|
||||||
try:
|
try:
|
||||||
genre_id = cursor.fetchone()[0]
|
genre_id = cursor.fetchone()[0]
|
||||||
except:
|
except:
|
||||||
|
@ -994,7 +994,7 @@ class WriteKodiVideoDB():
|
||||||
cursor.execute(query, (genre_id, id, mediatype))
|
cursor.execute(query, (genre_id, id, mediatype))
|
||||||
else:
|
else:
|
||||||
# Kodi Gotham or Helix
|
# Kodi Gotham or Helix
|
||||||
cursor.execute("SELECT idGenre as idGenre FROM genre WHERE strGenre = ?", (genre,))
|
cursor.execute("SELECT idGenre as idGenre FROM genre WHERE strGenre = ? COLLATE NOCASE", (genre,))
|
||||||
try:
|
try:
|
||||||
idGenre = cursor.fetchone()[0]
|
idGenre = cursor.fetchone()[0]
|
||||||
except:
|
except:
|
||||||
|
@ -1026,7 +1026,7 @@ class WriteKodiVideoDB():
|
||||||
|
|
||||||
if kodiVersion == 15 or kodiVersion == 16:
|
if kodiVersion == 15 or kodiVersion == 16:
|
||||||
# Kodi Isengard
|
# Kodi Isengard
|
||||||
cursor.execute("SELECT country_id as country_id FROM country WHERE name = ?", (country,))
|
cursor.execute("SELECT country_id as country_id FROM country WHERE name = ? COLLATE NOCASE", (country,))
|
||||||
try:
|
try:
|
||||||
country_id = cursor.fetchone()[0]
|
country_id = cursor.fetchone()[0]
|
||||||
except:
|
except:
|
||||||
|
@ -1043,7 +1043,7 @@ class WriteKodiVideoDB():
|
||||||
cursor.execute(query, (country_id, id, mediatype))
|
cursor.execute(query, (country_id, id, mediatype))
|
||||||
else:
|
else:
|
||||||
# Kodi Gotham or Helix
|
# Kodi Gotham or Helix
|
||||||
cursor.execute("SELECT idCountry as idCountry FROM country WHERE strCountry = ?", (country,))
|
cursor.execute("SELECT idCountry as idCountry FROM country WHERE strCountry = ? COLLATE NOCASE", (country,))
|
||||||
try:
|
try:
|
||||||
idCountry = cursor.fetchone()[0]
|
idCountry = cursor.fetchone()[0]
|
||||||
except:
|
except:
|
||||||
|
@ -1068,7 +1068,7 @@ class WriteKodiVideoDB():
|
||||||
|
|
||||||
if kodiVersion == 15 or kodiVersion == 16:
|
if kodiVersion == 15 or kodiVersion == 16:
|
||||||
# Kodi Isengard
|
# Kodi Isengard
|
||||||
cursor.execute("SELECT studio_id as studio_id FROM studio WHERE name = ?", (studio,))
|
cursor.execute("SELECT studio_id as studio_id FROM studio WHERE name = ? COLLATE NOCASE", (studio,))
|
||||||
try:
|
try:
|
||||||
studio_id = cursor.fetchone()[0]
|
studio_id = cursor.fetchone()[0]
|
||||||
except: # Studio does not exists.
|
except: # Studio does not exists.
|
||||||
|
@ -1083,7 +1083,7 @@ class WriteKodiVideoDB():
|
||||||
cursor.execute(query, (studio_id, id, mediatype))
|
cursor.execute(query, (studio_id, id, mediatype))
|
||||||
else:
|
else:
|
||||||
# Kodi Gotham or Helix
|
# Kodi Gotham or Helix
|
||||||
cursor.execute("SELECT idstudio as idstudio FROM studio WHERE strstudio = ?",(studio,))
|
cursor.execute("SELECT idstudio as idstudio FROM studio WHERE strstudio = ? COLLATE NOCASE",(studio,))
|
||||||
try:
|
try:
|
||||||
idstudio = cursor.fetchone()[0]
|
idstudio = cursor.fetchone()[0]
|
||||||
except: # Studio does not exists.
|
except: # Studio does not exists.
|
||||||
|
@ -1113,7 +1113,7 @@ class WriteKodiVideoDB():
|
||||||
|
|
||||||
if kodiVersion == 15 or kodiVersion == 16:
|
if kodiVersion == 15 or kodiVersion == 16:
|
||||||
# Kodi Isengard
|
# Kodi Isengard
|
||||||
cursor.execute("SELECT tag_id as tag_id FROM tag WHERE name = ?", (tag,))
|
cursor.execute("SELECT tag_id as tag_id FROM tag WHERE name = ? COLLATE NOCASE", (tag,))
|
||||||
try:
|
try:
|
||||||
tag_id = cursor.fetchone()[0]
|
tag_id = cursor.fetchone()[0]
|
||||||
except:
|
except:
|
||||||
|
@ -1134,7 +1134,7 @@ class WriteKodiVideoDB():
|
||||||
cursor.execute(query, (id, mediatype, tag_id))
|
cursor.execute(query, (id, mediatype, tag_id))
|
||||||
else:
|
else:
|
||||||
# Kodi Gotham or Helix
|
# Kodi Gotham or Helix
|
||||||
cursor.execute("SELECT idTag as idTag FROM tag WHERE strTag = ?", (tag,))
|
cursor.execute("SELECT idTag as idTag FROM tag WHERE strTag = ? COLLATE NOCASE", (tag,))
|
||||||
try:
|
try:
|
||||||
idTag = cursor.fetchone()[0]
|
idTag = cursor.fetchone()[0]
|
||||||
except:
|
except:
|
||||||
|
@ -1224,7 +1224,7 @@ class WriteKodiVideoDB():
|
||||||
cursor.execute("SELECT kodi_id FROM emby WHERE emby_id = ?", (boxsetmovieid,))
|
cursor.execute("SELECT kodi_id FROM emby WHERE emby_id = ?", (boxsetmovieid,))
|
||||||
try:
|
try:
|
||||||
movieid = cursor.fetchone()[0]
|
movieid = cursor.fetchone()[0]
|
||||||
cursor.execute("SELECT idSet FROM sets WHERE strSet = ?", (strSet,))
|
cursor.execute("SELECT idSet FROM sets WHERE strSet = ? COLLATE NOCASE", (strSet,))
|
||||||
setid = cursor.fetchone()[0]
|
setid = cursor.fetchone()[0]
|
||||||
except: pass
|
except: pass
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue