Closed TCke83 closed 4 years ago
running into this as well as of yesterday. it looks as though the username has been removed from the URIs. I added a line in translator.py ~line 355 forcing a username and it's working for now at least.
elif len(parts) == 2 and parts[0] in ('playlist'):
return _result(uri, parts[0], parts[1], "username")
Hi, can you specify with translator.py file did you modified? mopidy-spotify/mopidy_spotify/translator.py here is only 263 lines
Files found via: sudo find / -name "translator.py" are not so long with 355 lines
If you really solved the issue. Is possible to add it to pip install release?
@Stybyk ah, i'm using an older version. 3.1.0
/usr/local/lib/python2.7/dist-packages/Mopidy_Spotify-3.1.0-py2.7.egg/mopidy_spotify/translator.py
def parse_uri(uri):
parsed_uri = urlparse.urlparse(uri)
schemes = ('http', 'https')
netlocs = ('open.spotify.com', 'play.spotify.com')
if parsed_uri.scheme == 'spotify':
parts = parsed_uri.path.split(':')
elif parsed_uri.scheme in schemes and parsed_uri.netloc in netlocs:
parts = parsed_uri.path[1:].split('/')
else:
parts = []
# Strip out empty parts to ensure we are strict about URI parsing.
parts = [p for p in parts if p.strip()]
if len(parts) == 2 and parts[0] in ('track', 'album', 'artist'):
return _result(uri, parts[0], parts[1], None)
elif len(parts) == 2 and parts[0] in ('playlist'):
return _result(uri, parts[0], parts[1], "***USERNAME***")
elif len(parts) == 3 and parts[0] == 'user' and parts[2] == 'starred':
if parsed_uri.scheme == 'spotify':
return _result(uri, 'starred', None, parts[1])
elif len(parts) == 3 and parts[0] == 'playlist':
return _result(uri, 'playlist', parts[2], parts[1])
elif len(parts) == 4 and parts[0] == 'user' and parts[2] == 'playlist':
return _result(uri, 'playlist', parts[3], parts[1])
raise ValueError('Could not parse %r as a Spotify URI' % uri)
@Stybyk ah, i'm using an older version. 3.1.0
/usr/local/lib/python2.7/dist-packages/Mopidy_Spotify-3.1.0-py2.7.egg/mopidy_spotify/translator.py
def parse_uri(uri): parsed_uri = urlparse.urlparse(uri) schemes = ('http', 'https') netlocs = ('open.spotify.com', 'play.spotify.com') if parsed_uri.scheme == 'spotify': parts = parsed_uri.path.split(':') elif parsed_uri.scheme in schemes and parsed_uri.netloc in netlocs: parts = parsed_uri.path[1:].split('/') else: parts = [] # Strip out empty parts to ensure we are strict about URI parsing. parts = [p for p in parts if p.strip()] if len(parts) == 2 and parts[0] in ('track', 'album', 'artist'): return _result(uri, parts[0], parts[1], None) elif len(parts) == 2 and parts[0] in ('playlist'): return _result(uri, parts[0], parts[1], "***USERNAME***") elif len(parts) == 3 and parts[0] == 'user' and parts[2] == 'starred': if parsed_uri.scheme == 'spotify': return _result(uri, 'starred', None, parts[1]) elif len(parts) == 3 and parts[0] == 'playlist': return _result(uri, 'playlist', parts[2], parts[1]) elif len(parts) == 4 and parts[0] == 'user' and parts[2] == 'playlist': return _result(uri, 'playlist', parts[3], parts[1]) raise ValueError('Could not parse %r as a Spotify URI' % uri)
If I add those two lines it failes when i try to load the playlist, so this doesn't really look like a fix
did you replace ***USERNAME***
with your spotify username? it's just a bandaid, that's what helped for me.
did you replace
***USERNAME***
with your spotify username? it's just a bandaid, that's what helped for me.
Yes i did, i've printed the link return value for the translator call:
Link(uri='spotify:playlist:1MpVIj7sqfgmd078BreKKP', type=u'playlist', id=u'1MpVIj7sqfgmd078BreKKP', owner=u'tcke83')
Shouldn't the username be present in de uri also?
That's what we are compensating for – the API seems to not be including it any longer. If you're returning from the call successfully, you're having a different issue. Mine was explicitly the lack of the username in the URI
Failed to lookup "spotify:playlist:2UNm9TY5FiohSFenZHXFyu": Failed to get link from Spotify URI: u'spotify:playlist:2UNm9TY5FiohSFenZHXFyu'
is the error that i get when i select the playlist for playback, the username is not in the uri (as you can see in the Link from previous comment)
That is a different error than Mar 3 18:19:41 mopidy rc.local[1021]: ValueError: Could not parse 'spotify:playlist:63Phh7U3VFWdZYvjQt8zyv' as a Spotify URI so you've progressed past the initial error you posted. It's likely the other playlist issue from a while back, I also had that but applied a fix from another thread.
Worth looking here: https://github.com/mopidy/mopidy-spotify/issues/182
Since a few day's i'm unable to load contents of playlist using mopidy with the mopidy-spotify plugin. It shows following error in the logs:
I've found a similar thread but there is stated the spotify playlist URI is incorrect without a username, but the playlists urls are the ones i use also in my spotify app (url is retrieved when logged in to spotify). Anyone any suggestions how to solve this issues, both mopidy & mopidy-spotify are the most recent stable versions.
Any suggestions how to fix this?
Thans in advance.
Regards,
Tom