From 016b2db69b1feabc1835b0040725dcb298fe39dd Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Tue, 9 Apr 2013 23:35:00 +0200 Subject: [PATCH] mpd: Start numbering of duplicate playlist names at 2 --- mopidy/frontends/mpd/dispatcher.py | 2 +- tests/frontends/mpd/protocol/stored_playlists_test.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mopidy/frontends/mpd/dispatcher.py b/mopidy/frontends/mpd/dispatcher.py index 0054a6f1..660e1739 100644 --- a/mopidy/frontends/mpd/dispatcher.py +++ b/mopidy/frontends/mpd/dispatcher.py @@ -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 diff --git a/tests/frontends/mpd/protocol/stored_playlists_test.py b/tests/frontends/mpd/protocol/stored_playlists_test.py index 1936e4c4..d837b0fa 100644 --- a/tests/frontends/mpd/protocol/stored_playlists_test.py +++ b/tests/frontends/mpd/protocol/stored_playlists_test.py @@ -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):