set current_track to None on clear commands - required by Sonata

This commit is contained in:
Johannes Knutsen 2010-03-30 02:34:58 +02:00
parent 818e602221
commit 5a9b141657
2 changed files with 2 additions and 0 deletions

View File

@ -87,6 +87,7 @@ class BaseCurrentPlaylistController(object):
def clear(self):
"""Clear the current playlist."""
self.backend.playback.stop()
self.backend.playback.current_track = None
self.playlist = Playlist()
def get_by_id(self, id):

View File

@ -543,6 +543,7 @@ class CurrentPlaylistHandlerTest(unittest.TestCase):
self.assertEquals(self.b.current_playlist.playlist.length, 5)
result = self.h.handle_request(u'clear')
self.assertEquals(self.b.current_playlist.playlist.length, 0)
self.assertEquals(self.b.playback.current_track, None)
self.assert_(u'OK' in result)
def test_delete_songpos(self):