Make sure that extra arguments on the Spotify URI are discarded during the URI parse

This commit is contained in:
Fabio Manganiello 2019-01-30 09:08:29 +01:00
parent ee0040fba6
commit 05a1713b92

View file

@ -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)