mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-24 09:46:11 +00:00
Fix crash during initial sync for songs
This commit is contained in:
parent
993ef282e7
commit
10606f733d
1 changed files with 18 additions and 9 deletions
|
@ -2209,22 +2209,31 @@ class Music(Items):
|
|||
emby_db.updateReference(itemid, checksum)
|
||||
|
||||
def getSongRatingAndComment(self, embyid, emby_rating, API):
|
||||
|
||||
kodicursor = self.kodicursor
|
||||
|
||||
previous_values = None
|
||||
filename = API.getFilePath()
|
||||
rating = 0
|
||||
emby_rating = int(round(emby_rating,0))
|
||||
emby_rating = int(round(emby_rating, 0))
|
||||
file_rating, comment = musicutils.getSongTags(filename)
|
||||
|
||||
currentvalue = None
|
||||
kodiid = self.emby_db.getItem_byId(embyid)[0]
|
||||
query = ' '.join(("SELECT rating", "FROM song", "WHERE idSong = ?" ))
|
||||
self.kodicursor.execute(query, (kodiid,))
|
||||
currentvalue = int(round(float(self.kodicursor.fetchone()[0]),0))
|
||||
|
||||
#only proceed if we actually have a rating from the file
|
||||
if file_rating == None and currentvalue:
|
||||
emby_dbitem = self.emby_db.getItem_byId(embyid)
|
||||
try:
|
||||
kodiid = emby_dbitem[0]
|
||||
except TypeError:
|
||||
# Item is not in database.
|
||||
currentvalue = None
|
||||
else:
|
||||
query = "SELECT rating FROM song WHERE idSong = ?"
|
||||
kodicursor.execute(query, (kodiid,))
|
||||
currentvalue = int(round(float(kodicursor.fetchone()[0]),0))
|
||||
|
||||
# Only proceed if we actually have a rating from the file
|
||||
if file_rating is None and currentvalue:
|
||||
return (currentvalue, comment)
|
||||
elif file_rating == None and not currentvalue:
|
||||
elif file_rating is None and currentvalue is None:
|
||||
return (emby_rating, comment)
|
||||
|
||||
file_rating = int(round(file_rating,0))
|
||||
|
|
Loading…
Reference in a new issue