From e57709b0b402497a55b726f5e35e9c7a471723f4 Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Sun, 7 Feb 2010 06:03:57 +0100 Subject: [PATCH] Update play code and next test --- mopidy/backends/gstreamer.py | 11 ++++++++++- tests/backends/__init__.py | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/mopidy/backends/gstreamer.py b/mopidy/backends/gstreamer.py index 314f4255..aa6b3646 100644 --- a/mopidy/backends/gstreamer.py +++ b/mopidy/backends/gstreamer.py @@ -43,10 +43,19 @@ class GStreamerPlaybackController(BasePlaybackController): self.bin = bin def play(self, id=None, position=None): - if not self.current_track: + playlist = self.backend.current_playlist.playlist + + if not self.current_track and not playlist.tracks: return False + elif playlist.tracks: + self.current_track = playlist.tracks[0] + self.playlist_position = 0 self.bin.set_property("uri", self.current_track.uri) self.bin.set_state(self.PLAYING) + self.state = self.PLAYING return True + + def next(self): + pass diff --git a/tests/backends/__init__.py b/tests/backends/__init__.py index e19f12c1..bb206ec3 100644 --- a/tests/backends/__init__.py +++ b/tests/backends/__init__.py @@ -62,6 +62,8 @@ class BasePlaybackControllerTest(object): def test_next(self): playback = self.backend.playback + playback.play() + old_position = playback.playlist_position old_uri = playback.current_track.uri