From 1b9094a36b886e47f99d8cb4a5b2b65d10a748c3 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Thu, 28 Feb 2019 16:33:36 +0100 Subject: [PATCH] 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 --- platypush/plugins/music/mpd/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platypush/plugins/music/mpd/__init__.py b/platypush/plugins/music/mpd/__init__.py index da7c0660b..7f2de8e3f 100644 --- a/platypush/plugins/music/mpd/__init__.py +++ b/platypush/plugins/music/mpd/__init__.py @@ -273,10 +273,10 @@ class MusicMpdPlugin(MusicPlugin): if resource.startswith('spotify:'): 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 - m = re.match('^spotify:playlist:(.*)$', resource) - resource = 'spotify:user:spotify:playlist:' + m.group(1) + resource = 'spotify:playlist:' + m.group(1) return resource @action