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