diff --git a/beetsplug/fromfilename.py b/beetsplug/fromfilename.py index e361f79f4..7655ba552 100644 --- a/beetsplug/fromfilename.py +++ b/beetsplug/fromfilename.py @@ -73,7 +73,10 @@ def all_matches(names, pattern): matches = {} for item, name in names.items(): m = re.match(pattern, name, re.IGNORECASE) - if m: + if m and m.groupdict(): + # Only yield a match when the regex applies *and* has + # capture groups. Otherwise, no information can be extracted + # from the filename. matches[item] = m.groupdict() else: return None diff --git a/docs/changelog.rst b/docs/changelog.rst index c20537639..5b039f43b 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -49,6 +49,8 @@ Other little fixes: * The importer now uses the album artist field when guessing existing metadata for albums (rather than just the track artist field). Thanks to geigerzaehler. +* :doc:`/plugins/fromfilename`: Fix a crash when a filename contained only a + track number (e.g., ``02.mp3``). 1.3.2 (December 22, 2013)