mpd: Start numbering of duplicate playlist names at 2

This commit is contained in:
Stein Magnus Jodal 2013-04-09 23:35:00 +02:00
parent 24271681c9
commit 016b2db69b
2 changed files with 2 additions and 2 deletions

View File

@ -248,7 +248,7 @@ class MpdContext(object):
def create_unique_name(self, playlist_name):
name = playlist_name
i = 1
i = 2
while name in self.playlist_uri_from_name:
name = '%s [%d]' % (playlist_name, i)
i += 1

View File

@ -71,7 +71,7 @@ class PlaylistsHandlerTest(protocol.BaseTestCase):
self.sendRequest('listplaylists')
self.assertInResponse('playlist: a')
self.assertInResponse('playlist: a [1]')
self.assertInResponse('playlist: a [2]')
self.assertInResponse('OK')
def test_listplaylists_ignores_playlists_without_name(self):