Fix GH-253

This commit is contained in:
krateng 2023-10-30 14:53:44 +01:00
parent 4389605907
commit dc05184552

View File

@ -110,16 +110,19 @@ def incoming_scrobble(rawscrobble,fix=True,client=None,api=None,dbconn=None):
scrobbledict = rawscrobble_to_scrobbledict(rawscrobble, fix, client) scrobbledict = rawscrobble_to_scrobbledict(rawscrobble, fix, client)
albumupdate = (malojaconfig["ALBUM_INFORMATION_TRUST"] == 'last') albumupdate = (malojaconfig["ALBUM_INFORMATION_TRUST"] == 'last')
if scrobbledict:
sqldb.add_scrobble(scrobbledict,update_album=albumupdate,dbconn=dbconn) sqldb.add_scrobble(scrobbledict,update_album=albumupdate,dbconn=dbconn)
proxy_scrobble_all(scrobbledict['track']['artists'],scrobbledict['track']['title'],scrobbledict['time']) proxy_scrobble_all(scrobbledict['track']['artists'],scrobbledict['track']['title'],scrobbledict['time'])
dbcache.invalidate_caches(scrobbledict['time']) dbcache.invalidate_caches(scrobbledict['time'])
#return {"status":"success","scrobble":scrobbledict} #return {"status":"success","scrobble":scrobbledict}
return scrobbledict return scrobbledict
else:
raise exceptions.MissingScrobbleParameters('artist')
@waitfordb @waitfordb
def reparse_scrobble(timestamp): def reparse_scrobble(timestamp):
@ -131,6 +134,8 @@ def reparse_scrobble(timestamp):
newscrobble = rawscrobble_to_scrobbledict(scrobble['rawscrobble']) newscrobble = rawscrobble_to_scrobbledict(scrobble['rawscrobble'])
if newscrobble:
track_id = sqldb.get_track_id(newscrobble['track']) track_id = sqldb.get_track_id(newscrobble['track'])
# check if id changed # check if id changed
@ -190,6 +195,11 @@ def rawscrobble_to_scrobbledict(rawscrobble, fix=True, client=None):
if not scrobbledict["track"]["album"]["albumtitle"]: if not scrobbledict["track"]["album"]["albumtitle"]:
del scrobbledict["track"]["album"] del scrobbledict["track"]["album"]
# discard if invalid
if len(scrobbledict['track']['artists']) == 0:
return None
# TODO: other checks
return scrobbledict return scrobbledict