Fix matching issue with alias types and use alias type id instead

- web service returns "Legal name" not "Legal Name"
- match is dependent on text strings, but since a while the service provides an alias type id
- use the type id instead for the match
- add ALIAS_TYPE_*_ID constants to picard/const
This commit is contained in:
Laurent Monin
2023-06-01 15:16:57 +02:00
parent 3d502c8fc8
commit 2012a07548
2 changed files with 12 additions and 4 deletions

View File

@@ -95,6 +95,11 @@ PICARD_URLS = {
# Various Artists MBID
VARIOUS_ARTISTS_ID = '89ad4ac3-39f7-470e-963a-56509c546377'
# Artist alias types
ALIAS_TYPE_ARTIST_NAME_ID = '894afba6-2816-3c24-8072-eadb66bd04bc'
ALIAS_TYPE_LEGAL_NAME_ID = 'd4dcd0c0-b341-3612-a332-c0ce797b25cf'
ALIAS_TYPE_SEARCH_HINT_ID = '1937e404-b981-3cb7-8151-4c86ebfc8d8e'
# Special purpose track titles
SILENCE_TRACK_TITLE = '[silence]'
DATA_TRACK_TITLE = '[data track]'

View File

@@ -30,7 +30,11 @@ from collections import namedtuple
from picard import log
from picard.config import get_config
from picard.const import RELEASE_FORMATS
from picard.const import (
ALIAS_TYPE_ARTIST_NAME_ID,
ALIAS_TYPE_LEGAL_NAME_ID,
RELEASE_FORMATS,
)
from picard.util import (
format_time,
linear_combination_of_weights,
@@ -106,7 +110,6 @@ _RELEASE_GROUP_TO_METADATA = {
'title': '~releasegroup',
}
_REPLACE_MAP = {}
_PREFIX_ATTRS = {'guest', 'additional', 'minor', 'solo'}
_BLANK_SPECIAL_RELTYPES = {'vocal': 'vocals'}
@@ -294,9 +297,9 @@ def _translate_artist_node(node, config=None):
if '_' in full_locale:
score = 0.4
root_parts.append((score, 5))
if alias['type'] == "Artist name":
if alias['type-id'] == ALIAS_TYPE_ARTIST_NAME_ID:
score = 0.8
elif alias['type'] == "Legal Name":
elif alias['type-id'] == ALIAS_TYPE_LEGAL_NAME_ID:
score = 0.5
else:
# as 2014/09/19, only Artist or Legal names should have the