Use positional str.format arg

This commit is contained in:
Rahul Ahuja 2019-09-04 21:18:07 -07:00
parent 8010488f37
commit 30cfd7ff80
3 changed files with 3 additions and 5 deletions

View file

@ -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

View file

@ -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,
}

View file

@ -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,
}