mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 10:16:11 +00:00
corrected check for music artists and also reset music db at full reset
This commit is contained in:
parent
93a52009dd
commit
e16cbcc87c
2 changed files with 25 additions and 6 deletions
|
@ -203,9 +203,9 @@ def reset():
|
|||
return
|
||||
xbmc.sleep(1000)
|
||||
|
||||
# delete db table data
|
||||
print "Doing DB Reset"
|
||||
connection = KodiSQL()
|
||||
# delete video db table data
|
||||
print "Doing Video DB Reset"
|
||||
connection = KodiSQL("video")
|
||||
cursor = connection.cursor( )
|
||||
cursor.execute('SELECT tbl_name FROM sqlite_master WHERE type="table"')
|
||||
rows = cursor.fetchall()
|
||||
|
@ -216,6 +216,21 @@ def reset():
|
|||
connection.commit()
|
||||
cursor.close()
|
||||
|
||||
if addonSettings.getSetting("enableMusicSync") == "true":
|
||||
# delete video db table data
|
||||
print "Doing Music DB Reset"
|
||||
connection = KodiSQL("music")
|
||||
cursor = connection.cursor( )
|
||||
cursor.execute('SELECT tbl_name FROM sqlite_master WHERE type="table"')
|
||||
rows = cursor.fetchall()
|
||||
for row in rows:
|
||||
tableName = row[0]
|
||||
if(tableName != "version"):
|
||||
cursor.execute("DELETE FROM " + tableName)
|
||||
connection.commit()
|
||||
cursor.close()
|
||||
|
||||
|
||||
# reset the install run flag
|
||||
WINDOW.setProperty("SyncInstallRunDone", "false")
|
||||
|
||||
|
|
|
@ -89,13 +89,17 @@ class WriteKodiMusicDB():
|
|||
if MBitem.get("DateCreated"):
|
||||
dateadded = MBitem["DateCreated"].split('.')[0].replace('T', " ")
|
||||
|
||||
#convenience/safety check: does the artist already exist?
|
||||
#safety check 1: does the artist already exist?
|
||||
cursor.execute("SELECT idArtist FROM artist WHERE strArtist = ?",(name,))
|
||||
result = cursor.fetchone()
|
||||
if result != None:
|
||||
artistid = result[0]
|
||||
else:
|
||||
artistid = None
|
||||
|
||||
#safety check 2: does the musicbrainzartistId already exist?
|
||||
cursor.execute("SELECT idArtist FROM artist WHERE strMusicBrainzArtistID = ?",(musicBrainsId,))
|
||||
result = cursor.fetchone()
|
||||
if result != None:
|
||||
artistid = result[0]
|
||||
|
||||
##### ADD THE ARTIST ############
|
||||
if artistid == None:
|
||||
|
|
Loading…
Reference in a new issue