How would i check my library and select the artist that appears the most for songs with multiple artists? Say, i have 10 songs from artist A, and i get a song with artists A and B, i want to select artist A as it’s the most common in my library.
Ended up writing a plugin for that, was the quickest way to fix this issue
from beets.plugins import BeetsPlugin
from beets.ui import Subcommand
modify_artists = Subcommand("multipleartists", help="Fix artists")
def modify(lib, opts, args):
all_artists = {}
for item in lib.items():
for artist in item.artists:
if artist in all_artists:
all_artists[artist] += 1
else:
all_artists[artist] = 1
for item in lib.items():
if not item.artists:
continue
counter = {}
for artist in item.artists:
if artist in all_artists:
counter[artist] = all_artists[artist]
else:
counter[artist] = 1
artist = max(counter, key=counter.get)
print(f"Modifying {item}, setting artist as {artist}")
item.artist = artist
item.albumartist = artist
item.store()
item.write()
modify_artists.func = modify
class MultipleArtists(BeetsPlugin):
def commands(self):
return [modify_artists]
Beware, this code has no confirmation or anything (nor is it great), its just for my personal use. Modify if you want to add confirmations/other stuff.