mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06: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
|
return
|
||||||
xbmc.sleep(1000)
|
xbmc.sleep(1000)
|
||||||
|
|
||||||
# delete db table data
|
# delete video db table data
|
||||||
print "Doing DB Reset"
|
print "Doing Video DB Reset"
|
||||||
connection = KodiSQL()
|
connection = KodiSQL("video")
|
||||||
cursor = connection.cursor( )
|
cursor = connection.cursor( )
|
||||||
cursor.execute('SELECT tbl_name FROM sqlite_master WHERE type="table"')
|
cursor.execute('SELECT tbl_name FROM sqlite_master WHERE type="table"')
|
||||||
rows = cursor.fetchall()
|
rows = cursor.fetchall()
|
||||||
|
@ -216,6 +216,21 @@ def reset():
|
||||||
connection.commit()
|
connection.commit()
|
||||||
cursor.close()
|
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
|
# reset the install run flag
|
||||||
WINDOW.setProperty("SyncInstallRunDone", "false")
|
WINDOW.setProperty("SyncInstallRunDone", "false")
|
||||||
|
|
||||||
|
|
|
@ -89,13 +89,17 @@ class WriteKodiMusicDB():
|
||||||
if MBitem.get("DateCreated"):
|
if MBitem.get("DateCreated"):
|
||||||
dateadded = MBitem["DateCreated"].split('.')[0].replace('T', " ")
|
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,))
|
cursor.execute("SELECT idArtist FROM artist WHERE strArtist = ?",(name,))
|
||||||
result = cursor.fetchone()
|
result = cursor.fetchone()
|
||||||
if result != None:
|
if result != None:
|
||||||
artistid = result[0]
|
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 ############
|
##### ADD THE ARTIST ############
|
||||||
if artistid == None:
|
if artistid == None:
|
||||||
|
|
Loading…
Reference in a new issue