diff --git a/beetsplug/discogs.py b/beetsplug/discogs.py index 30aa6d28d..820a0acbd 100644 --- a/beetsplug/discogs.py +++ b/beetsplug/discogs.py @@ -194,17 +194,16 @@ class DiscogsPlugin(BeetsPlugin): # patterns. # Regex has been tested here https://regex101.com/r/wyLdB4/2 - if album_id: - for pattern in [ - r'^\[?r?(?P\d+)\]?$', - r'discogs\.com/release/(?P\d+)-', - r'discogs\.com/[^/]+/release/(?P\d+)', - ]: - match = re.search(pattern, album_id) - if match: - return int(match.group('id')) - else: - return None + for pattern in [ + r'^\[?r?(?P\d+)\]?$', + r'discogs\.com/release/(?P\d+)-', + r'discogs\.com/[^/]+/release/(?P\d+)', + ]: + match = re.search(pattern, album_id) + if match: + 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