mpd: Start numbering of duplicate playlist names at 2
This commit is contained in:
parent
24271681c9
commit
016b2db69b
@ -248,7 +248,7 @@ class MpdContext(object):
|
|||||||
|
|
||||||
def create_unique_name(self, playlist_name):
|
def create_unique_name(self, playlist_name):
|
||||||
name = playlist_name
|
name = playlist_name
|
||||||
i = 1
|
i = 2
|
||||||
while name in self.playlist_uri_from_name:
|
while name in self.playlist_uri_from_name:
|
||||||
name = '%s [%d]' % (playlist_name, i)
|
name = '%s [%d]' % (playlist_name, i)
|
||||||
i += 1
|
i += 1
|
||||||
|
|||||||
@ -71,7 +71,7 @@ class PlaylistsHandlerTest(protocol.BaseTestCase):
|
|||||||
|
|
||||||
self.sendRequest('listplaylists')
|
self.sendRequest('listplaylists')
|
||||||
self.assertInResponse('playlist: a')
|
self.assertInResponse('playlist: a')
|
||||||
self.assertInResponse('playlist: a [1]')
|
self.assertInResponse('playlist: a [2]')
|
||||||
self.assertInResponse('OK')
|
self.assertInResponse('OK')
|
||||||
|
|
||||||
def test_listplaylists_ignores_playlists_without_name(self):
|
def test_listplaylists_ignores_playlists_without_name(self):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user