mpd: Replace / with | instead of whitespace in playlist names

This commit is contained in:
Stein Magnus Jodal 2014-08-17 23:25:09 +02:00
parent 027b7a53fe
commit a244761abc
3 changed files with 10 additions and 5 deletions

View File

@ -13,6 +13,11 @@ v0.20.0 (UNRELEASED)
- Add cover URL to all scanned files with MusicBrainz album IDs. (Fixes:
:issue:`697`, PR: :issue:`802`)
**MPD frontend**
- In stored playlist names, replace "/", which are illegal, with "|" instead of
a whitespace. Pipes are more similar to forward slash.
v0.19.4 (UNRELEASED)
====================

View File

@ -269,7 +269,7 @@ class MpdContext(object):
if not playlist.name:
continue
# TODO: add scheme to name perhaps 'foo (spotify)' etc.
name = self._invalid_playlist_chars.sub(' ', playlist.name)
name = self._invalid_playlist_chars.sub('|', playlist.name)
self.insert_name_uri_mapping(name, playlist.uri)
def lookup_playlist_from_name(self, name):

View File

@ -121,12 +121,12 @@ class PlaylistsHandlerTest(protocol.BaseTestCase):
self.assertNotInResponse('playlist: a\r')
self.assertInResponse('OK')
def test_listplaylists_replaces_forward_slash_with_space(self):
def test_listplaylists_replaces_forward_slash_with_pipe(self):
self.backend.playlists.playlists = [
Playlist(name='a/', uri='dummy:')]
Playlist(name='a/b', uri='dummy:')]
self.sendRequest('listplaylists')
self.assertInResponse('playlist: a ')
self.assertNotInResponse('playlist: a/')
self.assertInResponse('playlist: a|b')
self.assertNotInResponse('playlist: a/b')
self.assertInResponse('OK')
def test_load_appends_to_tracklist(self):