1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Scrobbling fixes

This commit is contained in:
krateng 2023-03-28 18:41:49 +02:00
parent 1a43aa302d
commit 69b456dc73
2 changed files with 9 additions and 5 deletions

View File

@ -494,19 +494,23 @@ def post_scrobble(
'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'])}" 'desc':f"Scrobbled {result['track']['title']} by {', '.join(result['track']['artists'])}",
'warnings':[]
} }
if extra_kwargs: if extra_kwargs:
responsedict['warnings'] = [ responsedict['warnings'] += [
{'type':'invalid_keyword_ignored','value':k, {'type':'invalid_keyword_ignored','value':k,
'desc':"This key was not recognized by the server and has been discarded."} 'desc':"This key was not recognized by the server and has been discarded."}
for k in extra_kwargs for k in extra_kwargs
] ]
if artist and artists: if artist and artists:
responsedict['warnings'] = [ responsedict['warnings'] += [
{'type':'mixed_schema','value':['artist','artists'], {'type':'mixed_schema','value':['artist','artists'],
'desc':"These two fields are meant as alternative methods to submit information. Use of both is discouraged, but works at the moment."} 'desc':"These two fields are meant as alternative methods to submit information. Use of both is discouraged, but works at the moment."}
] ]
if len(responsedict['warnings']) == 0: del responsedict['warnings']
return responsedict return responsedict

View File

@ -143,7 +143,7 @@ def rawscrobble_to_scrobbledict(rawscrobble, fix=True, client=None):
"artists":scrobbleinfo.get('track_artists'), "artists":scrobbleinfo.get('track_artists'),
"title":scrobbleinfo.get('track_title'), "title":scrobbleinfo.get('track_title'),
"album":{ "album":{
"title":scrobbleinfo.get('album_title') or scrobbleinfo.get('album_name'), "albumtitle":scrobbleinfo.get('album_title'),
"artists":scrobbleinfo.get('album_artists') "artists":scrobbleinfo.get('album_artists')
}, },
"length":scrobbleinfo.get('track_length') "length":scrobbleinfo.get('track_length')
@ -152,7 +152,7 @@ def rawscrobble_to_scrobbledict(rawscrobble, fix=True, client=None):
"origin":f"client:{client}" if client else "generic", "origin":f"client:{client}" if client else "generic",
"extra":{ "extra":{
k:scrobbleinfo[k] for k in scrobbleinfo if k not in k:scrobbleinfo[k] for k in scrobbleinfo if k not in
['scrobble_time','track_artists','track_title','track_length','scrobble_duration','album_title','album_name','album_artists'] ['scrobble_time','track_artists','track_title','track_length','scrobble_duration','album_title','album_artists']
}, },
"rawscrobble":rawscrobble "rawscrobble":rawscrobble
} }