New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading playlists with strange names #113

Closed
jodal opened this Issue Jun 15, 2011 · 2 comments

Comments

1 participant
@jodal
Member

jodal commented Jun 15, 2011

The following is a valid playlist, but it can't be used:

  Request from [::ffff:127.0.0.1]:46646: listplaylistinfo "all lart spotify:track:\\w\\{22\\} pastes"
DEBUG    2011-06-14 17:10:49,306 [1224:Thread-4] pykka
  Exception returned from SpotifyBackend (urn:uuid:63c4f5b8-11cb-473d-a994-1273ebbdf2d0) to caller:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pykka/actor.py", line 167, in _run
    response = self._handle_receive(message)
  File "/usr/local/lib/python2.7/dist-packages/pykka/actor.py", line 238, in _handle_receive
    return callee(*message['args'], **message['kwargs'])
  File "/home/xt/src/mopidy/mopidy/backends/base/stored_playlists.py", line 81, in get
    raise LookupError('"%s" match no playlists' % criteria_string)
LookupError: "name=all lart spotify:track:\\w\\{22\\} pastes" match no playlists
@jodal

This comment has been minimized.

Member

jodal commented Aug 1, 2011

I guess the issue here is with the \ escape chars.

@torhve How does the playlist look in your Spotify client? all lart spotify:track:\w\{22\} pastes, I guess?

Edited: Changed my guess.

@jodal

This comment has been minimized.

Member

jodal commented Aug 2, 2011

  1. Given a Spotify playlist named all lart spotify:track:\w\{22\} pastes with a single set of backslashes for escaping the regexp.
  2. listplaylists through Mopidy's MPD frontend returns: all lart spotify:track:\w\{22\} pastes with a single set of backslashes.
  3. Trying to load the playlist from any of the clients ncmpcpp, mpc, Sonata, Ario yields the command: load "all lart spotify:track:\\w\\{22\\} pastes" with a double set of backslashes, yielding a playlist not found error.
  4. Using telnet to send load "all lart spotify:track:\w\{22\} pastes" with a single set of backslashes works, and the playlist is loaded.

To me, it seems like Mopidy is treating backslashes consistently as regular chars, while the clients treat them consistently as something that must explicitly be escaped.

Looking at interaction between the original MPD server and ncmpcpp with Wireshark:

save "foo spot:track:\\w\\{foo\\}"
OK
lsinfo "/"
playlist: foo spot:track:\w\{foo\}
Last-Modified: 2011-08-02T00:22:52Z
OK
...
listplaylistinfo "foo spot:track:\\w\\{foo\\}"
file: lastfm://globaltags/Ambient
OK

Telneting to the MPD server to try without escaping the backslashes:

listplaylistinfo "foo spot:track:\w\{foo\}"
ACK [50@0] {listplaylistinfo} No such playlist

In other words, Mopidy is correct in not escaping responses, but it seems like we should unescape requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment