mirror of
https://github.com/beetbox/beets.git
synced 2025-12-24 09:33:46 +01:00
Use positional str.format arg
This commit is contained in:
parent
8010488f37
commit
30cfd7ff80
3 changed files with 3 additions and 5 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue