From 3df635eca2354fc24df02825c781bd84d85b752c Mon Sep 17 00:00:00 2001 From: Johannes Baiter Date: Wed, 29 May 2013 20:31:58 +0200 Subject: [PATCH] Make regex for Discogs ID more specific --- beetsplug/discogs.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/beetsplug/discogs.py b/beetsplug/discogs.py index d52c5b1fd..b213c589c 100644 --- a/beetsplug/discogs.py +++ b/beetsplug/discogs.py @@ -69,10 +69,11 @@ class DiscogsPlugin(BeetsPlugin): # of an input string as to avoid confusion with other metadata plugins. # An optional bracket can follow the integer, as this is how discogs # displays the release ID on its webpage. - match = re.search(r'(\d+)\]*$', album_id) + match = re.search(r'(^|\[*r|discogs\.com/.+/release/)(\d+)($|\])', + album_id) if not match: return None - result = Release(match.group(1)) + result = Release(match.group(2)) # Try to obtain title to verify that we indeed have a valid Release try: getattr(result, 'title')