Skip to content

Commit a76101e

Browse files
committed
Improve matching for VA releases
- 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
1 parent 62f16dd commit a76101e

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

picard/metadata.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
from PyQt5.QtCore import QObject
4545

4646
from picard.config import get_config
47+
from picard.const import VARIOUS_ARTISTS_ID
4748
from picard.mbjson import (
4849
artist_credit_from_node,
4950
get_score,
@@ -247,8 +248,22 @@ def compare_to_release_parts(self, release, weights):
247248

248249
if "albumartist" in self and "albumartist" in weights:
249250
a = self["albumartist"]
250-
b = artist_credit_from_node(release['artist-credit'])[0]
251-
parts.append((similarity2(a, b), weights["albumartist"]))
251+
release_artists = release['artist-credit']
252+
b = artist_credit_from_node(release_artists)[0]
253+
artist_weight = weights["albumartist"]
254+
if a.lower() in {'various', 'various artists'}:
255+
# if artise in tag is 'various' or 'various artists',
256+
# it is very likely we look for a VA compilation
257+
# so increase the artist's weight
258+
artist_weight *= 2
259+
if release_artists[0]['artist']['id'] == VARIOUS_ARTISTS_ID:
260+
# it is fairly common VA release are tagged with label's name
261+
# so if a release is credited to VA, assume it is similar
262+
# to artist in tag
263+
sim = 1.0
264+
else:
265+
sim = similarity2(a, b)
266+
parts.append((sim, artist_weight))
252267

253268
try:
254269
a = int(self["totaltracks"])

0 commit comments

Comments
 (0)