From 86fee33fdf9bc8d02c59261ea536535aafd51139 Mon Sep 17 00:00:00 2001 From: Laurent Monin Date: Wed, 13 Oct 2021 14:59:49 +0200 Subject: [PATCH] PICARD-2655: 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 --- picard/metadata.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/picard/metadata.py b/picard/metadata.py index a6ae893d1f..5b6eb24db3 100644 --- a/picard/metadata.py +++ b/picard/metadata.py @@ -46,6 +46,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, @@ -253,8 +254,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)) if "totaltracks" in weights: try: