From c28a753fb96972d7c67aa989c11147f1fda06d23 Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Sun, 14 Feb 2010 18:32:40 +0100 Subject: [PATCH] Greatly simplify next and previous --- mopidy/backends/__init__.py | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/mopidy/backends/__init__.py b/mopidy/backends/__init__.py index 92b6a7c1..8c963aec 100644 --- a/mopidy/backends/__init__.py +++ b/mopidy/backends/__init__.py @@ -112,31 +112,13 @@ class BasePlaybackController(object): raise NotImplementedError def next(self): - # FIXME needs to be simplified by using next_track - playlist = self.backend.current_playlist.playlist - - if not self.current_track: - self.play() - elif self.playlist_position + 1 >= len(playlist.tracks): + if not self.next_track: self.stop() else: - next_track = playlist.tracks[self.playlist_position+1] - self.play(next_track) + self.play(self.next_track) def previous(self): - # FIXME needs to be simplified by using previous_track - playlist = self.backend.current_playlist.playlist - - if not self.current_track: - self.play() - elif not playlist.tracks: - self.stop() - elif self.playlist_position - 1 > 0: - first_track = playlist.tracks[0] - self.play(first_track) - else: - previous_track = playlist.tracks[self.playlist_position-1] - self.play(previous_track) + self.play(self.previous_track) def pause(self): raise NotImplementedError