Some hysterical guy has Spotify has decided to change the playlists URI

format again in the last couple of months with no notice nor
back-compatibility plan. Normalizing playlist URIs in the new (or
old-old?) format while innerly cursing at the incompetency of Spotify
This commit is contained in:
Fabio Manganiello 2019-02-28 16:33:36 +01:00
parent 65d6e5a5f6
commit 1b9094a36b

View file

@ -273,10 +273,10 @@ class MusicMpdPlugin(MusicPlugin):
if resource.startswith('spotify:'): if resource.startswith('spotify:'):
resource = resource.split('?')[0] resource = resource.split('?')[0]
if resource.startswith('spotify:playlist:'): m = re.match('spotify:user:[^:]+:playlist:(.+?)')
if m:
# Old Spotify URI format, convert it to new # Old Spotify URI format, convert it to new
m = re.match('^spotify:playlist:(.*)$', resource) resource = 'spotify:playlist:' + m.group(1)
resource = 'spotify:user:spotify:playlist:' + m.group(1)
return resource return resource
@action @action