Skip to content

Commit

Permalink
Improve matching for VA releases
Browse files Browse the repository at this point in the history
- if an album was incorrectly tagged with a label name or whatever, instead of Various Artists
Picard tries to match Various Artists (from database) to the name, usually leading to a very low similarity, reducing a lot the chance to find the correct release

- a contrario, if an album was tagged with Various Artists, it is very likely it is a VA compilation, so increase the weight
  • Loading branch information
zas committed Oct 13, 2021
1 parent 62f16dd commit 4ef9846
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions picard/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
from PyQt5.QtCore import QObject

from picard.config import get_config
from picard.const import VARIOUS_ARTISTS_ID
from picard.mbjson import (
artist_credit_from_node,
get_score,
Expand Down Expand Up @@ -247,8 +248,22 @@ def compare_to_release_parts(self, release, weights):

if "albumartist" in self and "albumartist" in weights:
a = self["albumartist"]
b = artist_credit_from_node(release['artist-credit'])[0]
parts.append((similarity2(a, b), weights["albumartist"]))
release_artists = release['artist-credit']
b = artist_credit_from_node(release_artists)[0]
artist_weight = weights["albumartist"]
if a.lower() in {'various', 'various artists'}:
# if artist in tag is 'various' or 'various artists',
# it is very likely we look for a VA compilation
# so increase the artist's weight
artist_weight *= 2
if release_artists[0]['artist']['id'] == VARIOUS_ARTISTS_ID:
# it is fairly common VA release are tagged with label's name
# so if a release is credited to VA, assume it is similar
# to artist in tag
sim = 1.0
else:
sim = similarity2(a, b)
parts.append((sim, artist_weight))

try:
a = int(self["totaltracks"])
Expand Down

0 comments on commit 4ef9846

Please sign in to comment.