Fix #1029: whitespace-only searches

This commit is contained in:
Adrian Sampson 2014-10-24 16:32:04 -07:00
parent 6aa9e60756
commit 51e57022cb
2 changed files with 6 additions and 4 deletions

View file

@ -310,9 +310,9 @@ def match_album(artist, album, tracks=None, limit=SEARCH_LIMIT):
optionally, a number of tracks on the album.
"""
# Build search criteria.
criteria = {'release': album.lower()}
criteria = {'release': album.lower().strip()}
if artist is not None:
criteria['artist'] = artist.lower()
criteria['artist'] = artist.lower().strip()
else:
# Various Artists search.
criteria['arid'] = VARIOUS_ARTISTS_ID
@ -341,8 +341,8 @@ def match_track(artist, title, limit=SEARCH_LIMIT):
objects. May raise a MusicBrainzAPIError.
"""
criteria = {
'artist': artist.lower(),
'recording': title.lower(),
'artist': artist.lower().strip(),
'recording': title.lower().strip(),
}
if not any(criteria.itervalues()):

View file

@ -44,6 +44,8 @@ Fixes:
the Discogs servers. Thanks to Dustin Rodriguez.
* :doc:`/plugins/embedart`: Do not log "embedding album art into..." messages
during the import process.
* Fix a crash in the autotagger when files had only whitespace in their
metadata.
1.3.8 (September 17, 2014)