From c52ad81fc2c6c7f2ad6384af0e351334614e3246 Mon Sep 17 00:00:00 2001 From: krateng Date: Fri, 22 Apr 2022 17:51:42 +0200 Subject: [PATCH] Fixed destructive updating with missing fields --- maloja/database/sqldb.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/maloja/database/sqldb.py b/maloja/database/sqldb.py index adae4cb..170a701 100644 --- a/maloja/database/sqldb.py +++ b/maloja/database/sqldb.py @@ -216,14 +216,14 @@ def scrobble_dict_to_db(info,dbconn=None): "origin":info.get('origin'), "duration":info.get('duration'), "track_id":get_track_id(info.get('track'),dbconn=dbconn), - "extra":json.dumps(info.get('extra')), - "rawscrobble":json.dumps(info.get('rawscrobble')) + "extra":json.dumps(info.get('extra')) if info.get('extra') else None, + "rawscrobble":json.dumps(info.get('rawscrobble')) if info.get('rawscrobble') else None } def track_dict_to_db(info,dbconn=None): return { "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') }