From 0bdcb94f5b997ff6eb574e72a8db17e887766e3d Mon Sep 17 00:00:00 2001 From: krateng Date: Thu, 30 Mar 2023 17:18:08 +0200 Subject: [PATCH] Scrobble guessing can now use rawscrobble --- maloja/database/sqldb.py | 5 +++++ maloja/proccontrol/tasks/parse_albums.py | 3 +++ 2 files changed, 8 insertions(+) diff --git a/maloja/database/sqldb.py b/maloja/database/sqldb.py index 882884b..0497456 100644 --- a/maloja/database/sqldb.py +++ b/maloja/database/sqldb.py @@ -1532,6 +1532,11 @@ def guess_albums(track_ids=None,replace=False,dbconn=None): extrainfo = json.loads(row.extra) albumtitle = extrainfo.get("album_name") or extrainfo.get("album_title") albumartists = extrainfo.get("album_artists",[]) + if not albumtitle: + # try the raw scrobble + extrainfo = json.loads(row.rawscrobble) + albumtitle = extrainfo.get("album_name") or extrainfo.get("album_title") + albumartists = albumartists or extrainfo.get("album_artists",[]) if albumtitle: hashable_albuminfo = tuple([*albumartists,albumtitle]) possible_albums.setdefault(row.track_id,{}).setdefault(hashable_albuminfo,0) diff --git a/maloja/proccontrol/tasks/parse_albums.py b/maloja/proccontrol/tasks/parse_albums.py index 618eabf..125df0c 100644 --- a/maloja/proccontrol/tasks/parse_albums.py +++ b/maloja/proccontrol/tasks/parse_albums.py @@ -3,6 +3,9 @@ def parse_albums(replace=False): + from ...database import set_aux_mode + set_aux_mode() + from ...database.sqldb import guess_albums, get_album_id, add_track_to_album print("Parsing album information...")