fix searching when to tags are present

This commit is contained in:
Adrian Sampson 2011-12-06 19:05:53 -08:00
parent def0f2c0e5
commit 00e7523374
3 changed files with 9 additions and 2 deletions

View file

@ -117,7 +117,8 @@ def _item_candidates(item, artist, title):
out = []
# MusicBrainz candidates.
out.extend(mb.match_track(artist, title))
if artist and title:
out.extend(mb.match_track(artist, title))
# Plugin candidates.
out.extend(plugins.item_candidates(item))

View file

@ -17,7 +17,6 @@ releases and tracks.
"""
import logging
import re
import copy
from munkres import Munkres
from unidecode import unidecode

View file

@ -157,6 +157,10 @@ def match_album(artist, album, tracks=None, limit=SEARCH_LIMIT):
if tracks is not None:
criteria['tracks'] = str(tracks)
# Abort if we have no search terms.
if not any(criteria.itervalues()):
return
_adapt_criteria(criteria)
res = musicbrainz3.release_search(limit=limit, **criteria)
for release in res['release-list']:
@ -173,6 +177,9 @@ def match_track(artist, title, limit=SEARCH_LIMIT):
'recording': title,
}
if not any(criteria.itervalues()):
return
_adapt_criteria(criteria)
res = musicbrainz3.recording_search(limit=limit, **criteria)
for recording in res['recording-list']: