mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Ensured API consistency to v2 for scrobbling
This commit is contained in:
parent
781ed66357
commit
4682914b88
@ -250,13 +250,24 @@ def post_scrobble(artist:Multi=None,auth_result=None,**keys):
|
||||
# for logging purposes, don't pass values that we didn't actually supply
|
||||
rawscrobble = {k:rawscrobble[k] for k in rawscrobble if rawscrobble[k]}
|
||||
|
||||
return database.incoming_scrobble(
|
||||
result = database.incoming_scrobble(
|
||||
rawscrobble,
|
||||
client='browser' if auth_result.get('doreah_native_auth_check') else auth_result.get('client'),
|
||||
api='native/v1',
|
||||
fix=(keys.get("nofix") is None)
|
||||
)
|
||||
|
||||
if result:
|
||||
return {
|
||||
'status': 'success',
|
||||
'track': {
|
||||
'artists':result['track']['artists'],
|
||||
'title':result['track']['title']
|
||||
}
|
||||
}
|
||||
else:
|
||||
return {"status":"failure"}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -90,7 +90,8 @@ def incoming_scrobble(rawscrobble,fix=True,client=None,api=None,dbconn=None):
|
||||
|
||||
if (not "track_artists" in rawscrobble) or (len(rawscrobble['track_artists']) == 0) or (not "track_title" in rawscrobble):
|
||||
log(f"Invalid Scrobble [Client: {client} | API: {api}]: {rawscrobble} ",color='red')
|
||||
return {"status":"failure"}
|
||||
#return {"status":"failure"}
|
||||
return False
|
||||
|
||||
log(f"Incoming scrobble [Client: {client} | API: {api}]: {rawscrobble}")
|
||||
|
||||
@ -127,8 +128,8 @@ def incoming_scrobble(rawscrobble,fix=True,client=None,api=None,dbconn=None):
|
||||
|
||||
dbcache.invalidate_caches(scrobbledict['time'])
|
||||
|
||||
return {"status":"success","scrobble":scrobbledict}
|
||||
|
||||
#return {"status":"success","scrobble":scrobbledict}
|
||||
return scrobbledict
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user