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

Case insensitive album merging

This commit is contained in:
krateng 2023-04-01 00:49:31 +02:00
parent 54a085c5b2
commit 9443ad2f62

View File

@ -81,16 +81,18 @@ Please specify your album parsing strategy:
continue
if strategy in ['all','majority','most']:
albums.setdefault(albuminfo['albumtitle'],{'track_ids':[],'artists':{}})
albums[albuminfo['albumtitle']]['track_ids'].append(track_id)
cleantitle = albuminfo['albumtitle'].lower()
albums.setdefault(cleantitle,{'track_ids':[],'artists':{},'title':albuminfo['albumtitle']})
albums[cleantitle]['track_ids'].append(track_id)
for a in result[track_id]['guess_artists']:
albums[albuminfo['albumtitle']]['artists'].setdefault(a,0)
albums[albuminfo['albumtitle']]['artists'][a] += 1
albums[cleantitle]['artists'].setdefault(a,0)
albums[cleantitle]['artists'][a] += 1
for title in albums:
artistoptions = albums[title]['artists']
track_ids = albums[title]['track_ids']
for cleantitle in albums:
artistoptions = albums[cleantitle]['artists']
track_ids = albums[cleantitle]['track_ids']
realtitle = albums[cleantitle]['title']
if strategy == 'all':
artists = [a for a in artistoptions]
elif strategy == 'majority':
@ -99,7 +101,7 @@ Please specify your album parsing strategy:
artists = [max(artistoptions,key=artistoptions.get)]
for track_id in track_ids:
album_id = get_album_id({'albumtitle':title,'artists':artists})
album_id = get_album_id({'albumtitle':realtitle,'artists':artists})
add_track_to_album(track_id,album_id)
i=countup(i)