More robust Spotify URI parsing that discards optional arguments (e.g. si=) passed to the URL
This commit is contained in:
parent
7a80cd08ce
commit
ee0040fba6
1 changed files with 3 additions and 0 deletions
|
@ -257,6 +257,9 @@ class MusicMpdPlugin(MusicPlugin):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _parse_resource(cls, resource):
|
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:'):
|
if resource and resource.startswith('spotify:playlist:'):
|
||||||
# Old Spotify URI format, convert it to new
|
# Old Spotify URI format, convert it to new
|
||||||
m = re.match('^spotify:playlist:(.*)$', resource)
|
m = re.match('^spotify:playlist:(.*)$', resource)
|
||||||
|
|
Loading…
Reference in a new issue