Skip to content

Commit 5650862

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 580617b commit 5650862

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
@@ -46,6 +46,7 @@
4646
from PyQt5.QtCore import QObject
4747

4848
from picard.config import get_config
49+
from picard.const import VARIOUS_ARTISTS_ID
4950
from picard.mbjson import (
5051
artist_credit_from_node,
5152
get_score,
@@ -253,8 +254,22 @@ def compare_to_release_parts(self, release, weights):
253254

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

259274
if "totaltracks" in weights:
260275
try:

0 commit comments

Comments
 (0)