From ee0040fba6837d4876e9dc8f7091c083028a83a7 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Wed, 30 Jan 2019 09:04:15 +0100 Subject: [PATCH] More robust Spotify URI parsing that discards optional arguments (e.g. si=) passed to the URL --- platypush/plugins/music/mpd/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/platypush/plugins/music/mpd/__init__.py b/platypush/plugins/music/mpd/__init__.py index 7550bc0f05..adf163cd3b 100644 --- a/platypush/plugins/music/mpd/__init__.py +++ b/platypush/plugins/music/mpd/__init__.py @@ -257,6 +257,9 @@ class MusicMpdPlugin(MusicPlugin): @classmethod def _parse_resource(cls, resource): + m = re.search('^https://open.spotify.com/([^?]+)', resource) + if m: resource = 'spotify:{}'.format(m.group(1).replace('/', ':')) + if resource and resource.startswith('spotify:playlist:'): # Old Spotify URI format, convert it to new m = re.match('^spotify:playlist:(.*)$', resource)