Discard matches without required tags

Skip a match that doesn't have any of the config-defined tags I want to enforce.
This commit is contained in:
oprietop 2014-07-01 21:06:52 +02:00
parent e77814fa48
commit 6dbb60373f

View file

@ -350,7 +350,6 @@ def _recommendation(results):
return rec
def _add_candidate(items, results, info):
"""Given a candidate AlbumInfo object, attempt to add the candidate
to the output dictionary of AlbumMatch objects. This involves
@ -363,6 +362,12 @@ def _add_candidate(items, results, info):
if info.album_id in results:
log.debug('Duplicate.')
return
# Discard matches without required tags.
for req_tag in config['match']['required'].as_str_seq():
if getattr(info, req_tag) is None:
log.debug('Ignored. Missing required tag: %s' % req_tag)
return
# Find mapping between the items and the track info.
mapping, extra_items, extra_tracks = assign_items(items, info.tracks)