Fix next method so that test passes
This commit is contained in:
parent
b510d8fdae
commit
a724d8f0ff
@ -31,7 +31,7 @@ class BasePlaybackController(object):
|
|||||||
def __init__(self, backend):
|
def __init__(self, backend):
|
||||||
self.backend = backend
|
self.backend = backend
|
||||||
self.current_track = None
|
self.current_track = None
|
||||||
self.playlist_position = None
|
self.playlist_position = 0
|
||||||
|
|
||||||
def play(self, id=None, position=None):
|
def play(self, id=None, position=None):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|||||||
@ -60,8 +60,7 @@ class GStreamerPlaybackController(BasePlaybackController):
|
|||||||
if not self.current_track and not playlist.tracks:
|
if not self.current_track and not playlist.tracks:
|
||||||
return False
|
return False
|
||||||
elif playlist.tracks:
|
elif playlist.tracks:
|
||||||
self.current_track = playlist.tracks[0]
|
self.current_track = playlist.tracks[self.playlist_position]
|
||||||
self.playlist_position = 0
|
|
||||||
|
|
||||||
self.bin.set_property("uri", self.current_track.uri)
|
self.bin.set_property("uri", self.current_track.uri)
|
||||||
self.bin.set_state(gst.STATE_PLAYING)
|
self.bin.set_state(gst.STATE_PLAYING)
|
||||||
@ -69,4 +68,9 @@ class GStreamerPlaybackController(BasePlaybackController):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def next(self):
|
def next(self):
|
||||||
pass
|
playlist = self.backend.current_playlist.playlist
|
||||||
|
|
||||||
|
self.playlist_position += 1
|
||||||
|
self.current_track = playlist.tracks[self.playlist_position]
|
||||||
|
|
||||||
|
self.play()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user