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

Fixed destructive updating with missing fields

This commit is contained in:
krateng 2022-04-22 17:51:42 +02:00
parent f5d1fbc576
commit c52ad81fc2

View File

@ -216,14 +216,14 @@ def scrobble_dict_to_db(info,dbconn=None):
"origin":info.get('origin'), "origin":info.get('origin'),
"duration":info.get('duration'), "duration":info.get('duration'),
"track_id":get_track_id(info.get('track'),dbconn=dbconn), "track_id":get_track_id(info.get('track'),dbconn=dbconn),
"extra":json.dumps(info.get('extra')), "extra":json.dumps(info.get('extra')) if info.get('extra') else None,
"rawscrobble":json.dumps(info.get('rawscrobble')) "rawscrobble":json.dumps(info.get('rawscrobble')) if info.get('rawscrobble') else None
} }
def track_dict_to_db(info,dbconn=None): def track_dict_to_db(info,dbconn=None):
return { return {
"title":info.get('title'), "title":info.get('title'),
"title_normalized":normalize_name(info.get('title'),'') or None, "title_normalized":normalize_name(info.get('title','')) or None,
"length":info.get('length') "length":info.get('length')
} }