From 30cfd7ff80d5c2079dfe20d8acd170bd8533fa32 Mon Sep 17 00:00:00 2001 From: Rahul Ahuja Date: Wed, 4 Sep 2019 21:18:07 -0700 Subject: [PATCH] Use positional str.format arg --- beets/autotag/__init__.py | 4 +--- beetsplug/deezer.py | 2 +- beetsplug/spotify.py | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/beets/autotag/__init__.py b/beets/autotag/__init__.py index 9b3970f12..132c4ce52 100644 --- a/beets/autotag/__init__.py +++ b/beets/autotag/__init__.py @@ -299,9 +299,7 @@ class APIAutotaggerPlugin(BeetsPlugin): self._log.debug( u"Searching {} for {} '{}'", self.data_source, url_type, id_ ) - match = re.search( - self.id_regex['pattern'].format(url_type=url_type), str(id_) - ) + match = re.search(self.id_regex['pattern'].format(url_type), str(id_)) id_ = match.group(self.id_regex['match_group']) return id_ if id_ else None diff --git a/beetsplug/deezer.py b/beetsplug/deezer.py index 215ea3bf1..f68609470 100644 --- a/beetsplug/deezer.py +++ b/beetsplug/deezer.py @@ -36,7 +36,7 @@ class DeezerPlugin(APIAutotaggerPlugin): track_url = 'https://api.deezer.com/track/' data_source = 'Deezer' id_regex = { - 'pattern': r'(^|deezer\.com/([a-z]*/)?{url_type}/)([0-9]*)', + 'pattern': r'(^|deezer\.com/([a-z]*/)?{}/)([0-9]*)', 'match_group': 3, } diff --git a/beetsplug/spotify.py b/beetsplug/spotify.py index 66ee2a16d..221181fbe 100644 --- a/beetsplug/spotify.py +++ b/beetsplug/spotify.py @@ -48,7 +48,7 @@ class SpotifyPlugin(APIAutotaggerPlugin): # Spotify IDs consist of 22 alphanumeric characters # (zero-left-padded base62 representation of randomly generated UUID4) id_regex = { - 'pattern': r'(^|open\.spotify\.com/{url_type}/)([0-9A-Za-z]{{22}})', + 'pattern': r'(^|open\.spotify\.com/{}/)([0-9A-Za-z]{{22}})', 'match_group': 2, }