From 05a1713b9292fae22b758abf6fb175b8c5ed2c43 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Wed, 30 Jan 2019 09:08:29 +0100 Subject: [PATCH] Make sure that extra arguments on the Spotify URI are discarded during the URI parse --- platypush/plugins/music/mpd/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/platypush/plugins/music/mpd/__init__.py b/platypush/plugins/music/mpd/__init__.py index adf163cd3b..42bcdbfc83 100644 --- a/platypush/plugins/music/mpd/__init__.py +++ b/platypush/plugins/music/mpd/__init__.py @@ -257,10 +257,16 @@ class MusicMpdPlugin(MusicPlugin): @classmethod def _parse_resource(cls, resource): + if not resource: + return + m = re.search('^https://open.spotify.com/([^?]+)', resource) if m: resource = 'spotify:{}'.format(m.group(1).replace('/', ':')) - if resource and resource.startswith('spotify:playlist:'): + if resource.startswith('spotify:'): + resource = resource.split('?')[0] + + if resource.startswith('spotify:playlist:'): # Old Spotify URI format, convert it to new m = re.match('^spotify:playlist:(.*)$', resource) resource = 'spotify:user:spotify:playlist:' + m.group(1)