diff --git a/beetsplug/discogs.py b/beetsplug/discogs.py index 2bf277d83..90486850a 100644 --- a/beetsplug/discogs.py +++ b/beetsplug/discogs.py @@ -218,10 +218,9 @@ class DiscogsPlugin(BeetsPlugin): ]: match = re.search(pattern, album_id) if match: - break - if not match: - return None - return int(match.group('id')) + return int(match.group('id')) + + return None def album_for_id(self, album_id): """Fetches an album by its Discogs ID and returns an AlbumInfo object diff --git a/test/test_discogs.py b/test/test_discogs.py index a919a2261..4e62e7124 100644 --- a/test/test_discogs.py +++ b/test/test_discogs.py @@ -368,7 +368,7 @@ class DGAlbumInfoTest(_common.TestCase): ('005b84a0-ecd6-39f1-b2f6-6eb48756b268', ''), ] for test_pattern, expected in test_patterns: - match = DiscogsPlugin().extract_release_id_regex(test_pattern) + match = DiscogsPlugin.extract_release_id_regex(test_pattern) if not match: match = '' self.assertEqual(match, expected)