Merge remote branch 'knutz3n/singlerepeat' into gstreamer

This commit is contained in:
Stein Magnus Jodal 2010-08-16 21:07:05 +02:00
commit e7291c3d2c
2 changed files with 11 additions and 10 deletions

View File

@ -291,15 +291,15 @@ class BasePlaybackController(object):
if self.cp_track_at_eot:
self.play(self.cp_track_at_eot)
if self.consume:
self.backend.current_playlist.remove(cpid=original_cp_track[0])
if self.random and self.current_cp_track in self._shuffled:
self._shuffled.remove(self.current_cp_track)
else:
self.stop()
self.current_cp_track = None
if self.consume:
self.backend.current_playlist.remove(cpid=original_cp_track[0])
def on_current_playlist_change(self):
"""
Tell the playback controller that the current playlist has changed.
@ -322,18 +322,12 @@ class BasePlaybackController(object):
if self.state == self.STOPPED:
return
original_cp_track = self.current_cp_track
if self.cp_track_at_next:
self.play(self.cp_track_at_next)
else:
self.stop()
self.current_cp_track = None
# FIXME This should only be applied when reaching end of track, and not
# when pressing "next"
if self.consume:
self.backend.current_playlist.remove(cpid=original_cp_track[0])
if self.random and self.current_cp_track in self._shuffled:
self._shuffled.remove(self.current_cp_track)

View File

@ -832,6 +832,13 @@ class BasePlaybackControllerTest(object):
self.playback.consume = True
self.playback.play()
self.playback.next()
self.assert_(self.tracks[0] in self.backend.current_playlist.tracks)
@populate_playlist
def test_end_of_track_with_consume(self):
self.playback.consume = True
self.playback.play()
self.playback.end_of_track_callback()
self.assert_(self.tracks[0] not in self.backend.current_playlist.tracks)
@populate_playlist
@ -847,7 +854,7 @@ class BasePlaybackControllerTest(object):
self.playback.consume = True
self.playback.play()
for i in range(len(self.backend.current_playlist.tracks)):
self.playback.next()
self.playback.end_of_track_callback()
self.assertEqual(len(self.backend.current_playlist.tracks), 0)
@populate_playlist