mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Fixed album parsing from raw scrobble, GH-207
This commit is contained in:
parent
55363bf31b
commit
924d4718db
@ -1513,7 +1513,7 @@ def guess_albums(track_ids=None,replace=False,dbconn=None):
|
|||||||
|
|
||||||
# get all scrobbles of the respective tracks that have some info
|
# get all scrobbles of the respective tracks that have some info
|
||||||
conditions = [
|
conditions = [
|
||||||
DB['scrobbles'].c.extra.isnot(None)
|
DB['scrobbles'].c.extra.isnot(None) | DB['scrobbles'].c.rawscrobble.isnot(None)
|
||||||
]
|
]
|
||||||
if track_ids is not None:
|
if track_ids is not None:
|
||||||
# only do these tracks
|
# only do these tracks
|
||||||
@ -1537,10 +1537,13 @@ def guess_albums(track_ids=None,replace=False,dbconn=None):
|
|||||||
# for each track, count what album info appears how often
|
# for each track, count what album info appears how often
|
||||||
possible_albums = {}
|
possible_albums = {}
|
||||||
for row in result:
|
for row in result:
|
||||||
|
albumtitle, albumartists = None, None
|
||||||
|
if row.extra:
|
||||||
extrainfo = json.loads(row.extra)
|
extrainfo = json.loads(row.extra)
|
||||||
albumtitle = extrainfo.get("album_name") or extrainfo.get("album_title")
|
albumtitle = extrainfo.get("album_name") or extrainfo.get("album_title")
|
||||||
albumartists = extrainfo.get("album_artists",[])
|
albumartists = extrainfo.get("album_artists",[])
|
||||||
if not albumtitle:
|
if not albumtitle:
|
||||||
|
# either we didn't have info in the exta col, or there was no albumtitle
|
||||||
# try the raw scrobble
|
# try the raw scrobble
|
||||||
extrainfo = json.loads(row.rawscrobble)
|
extrainfo = json.loads(row.rawscrobble)
|
||||||
albumtitle = extrainfo.get("album_name") or extrainfo.get("album_title")
|
albumtitle = extrainfo.get("album_name") or extrainfo.get("album_title")
|
||||||
|
Loading…
Reference in New Issue
Block a user