mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Added descriptions to API return dicts
This commit is contained in:
parent
009d77a75e
commit
d208290956
@ -458,7 +458,8 @@ def post_scrobble(
|
||||
'track': {
|
||||
'artists':result['track']['artists'],
|
||||
'title':result['track']['title']
|
||||
}
|
||||
},
|
||||
'desc':f"Scrobbled {result['track']['title']} by {','.join(result['track']['artists'])}"
|
||||
}
|
||||
if extra_kwargs:
|
||||
responsedict['warnings'] = [
|
||||
@ -684,6 +685,12 @@ def merge_artists(target_id,source_ids):
|
||||
def reparse_scrobble(timestamp):
|
||||
"""Internal Use Only"""
|
||||
result = database.reparse_scrobble(timestamp)
|
||||
return {
|
||||
"status":"success"
|
||||
}
|
||||
if result:
|
||||
return {
|
||||
"status":"success"
|
||||
}
|
||||
else:
|
||||
return {
|
||||
"status":"no-operation",
|
||||
"desc":"No action was taken."
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ def reparse_scrobble(timestamp):
|
||||
scrobble = sqldb.get_scrobble(timestamp=timestamp, include_internal=True)
|
||||
|
||||
if not scrobble or not scrobble['rawscrobble']:
|
||||
return
|
||||
return False
|
||||
|
||||
newscrobble = rawscrobble_to_scrobbledict(scrobble['rawscrobble'])
|
||||
|
||||
@ -128,6 +128,9 @@ def reparse_scrobble(timestamp):
|
||||
# check if id changed
|
||||
if sqldb.get_track_id(scrobble['track']) != track_id:
|
||||
sqldb.edit_scrobble(timestamp, {'track':newscrobble['track']})
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def rawscrobble_to_scrobbledict(rawscrobble, fix=True, client=None):
|
||||
|
@ -41,7 +41,7 @@ function notifyCallback(request) {
|
||||
if (status == 200) {
|
||||
var notification_type = 'info';
|
||||
var title = "Success!";
|
||||
var msg = "Scrobbled " + body.track.title + " by " + body.track.artists.join(", ");
|
||||
var msg = body.desc || body;
|
||||
}
|
||||
else {
|
||||
var notification_type = 'warning';
|
||||
|
Loading…
Reference in New Issue
Block a user