Group preferred media patterns, in case they contain "|" to keep them separate from the number of media.

This commit is contained in:
Tai Lee 2013-06-03 00:25:31 +10:00
parent 809ea8c7f9
commit 45dc99f1a9
2 changed files with 10 additions and 6 deletions

View file

@ -415,7 +415,7 @@ def distance(items, album_info, mapping):
dist.add_string('media', likelies['media'], album_info.media)
# Preferred media.
preferred_media = [re.compile(r'(\d+x)?%s' % pattern, re.I) for pattern
preferred_media = [re.compile(r'(\d+x)?(%s)' % pattern, re.I) for pattern
in config['match']['preferred']['media'].get()]
if album_info.media and preferred_media:
dist.add_priority('media', album_info.media, preferred_media)

View file

@ -437,9 +437,13 @@ preferred
In addition to comparing the tagged metadata with the match metadata for
similarity, you can also specify an ordered list of preferred countries and
media types. A distance penalty will be applied if the country or media type
from the match metadata doesn't match. The order is important, the first item
will be most preferred.
media types.
A distance penalty will be applied if the country or media type from the match
metadata doesn't match. The order is important, the first item will be most
preferred. Each item may be a regular expression, and will be matched case
insensitively. The number of media will be stripped when matching preferred
media (e.g. "2x" in "2xCD").
You can also tell the autotagger to prefer matches that have a release year
closest to the original year for an album.
@ -448,8 +452,8 @@ Here's an example::
match:
preferred:
countries: ['US', 'GB', 'UK']
media: ['CD', 'Digital Media']
countries: ['US', 'GB|UK']
media: ['CD', 'Digital Media|File']
original_year: yes
By default, none of these options are enabled.