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

Scrobble guessing can now use rawscrobble

This commit is contained in:
krateng 2023-03-30 17:18:08 +02:00
parent e52d57e413
commit 0bdcb94f5b
2 changed files with 8 additions and 0 deletions

View File

@ -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)

View File

@ -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...")