diff --git a/mopidy/backends/base/playback.py b/mopidy/backends/base/playback.py index 973743e5..bb0ab3dc 100644 --- a/mopidy/backends/base/playback.py +++ b/mopidy/backends/base/playback.py @@ -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) diff --git a/tests/backends/base.py b/tests/backends/base.py index 05379c57..31892de2 100644 --- a/tests/backends/base.py +++ b/tests/backends/base.py @@ -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