From 6d3428ca9e901b0fa633f219ff2da3ca804fbff6 Mon Sep 17 00:00:00 2001 From: Kushal Das Date: Fri, 3 Oct 2008 14:57:33 +0530 Subject: Now next and previous buttons are working , only problem is to set default play/pause button --- jukeboxactivity.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'jukeboxactivity.py') diff --git a/jukeboxactivity.py b/jukeboxactivity.py index 565aa2e..fbb4e60 100755 --- a/jukeboxactivity.py +++ b/jukeboxactivity.py @@ -114,11 +114,23 @@ class JukeboxActivity(activity.Activity): pass def songchange(self,direction): - if self.playflag: - self.playflag = False - return + #if self.playflag: + # self.playflag = False + # return self.player.seek(0L) - if direction == "next" and self.currentplaying < len(self.playlist) - 1: + if direction == "prev" and self.currentplaying > 0: + self.currentplaying -= 1 + self.player.stop() + self.player = GstPlayer(self.videowidget) + self.player.connect("error", self._player_error_cb) + self.player.connect("tag", self._player_new_tag_cb) + self.player.connect("stream-info", self._player_stream_info_cb) + self.player.set_uri(self.playlist[self.currentplaying]) + logging.info("prev: " + self.playlist[self.currentplaying]) + #self.playflag = True + self.play_toggled() + self.player.connect("eos", self._player_eos_cb) + elif direction == "next" and self.currentplaying < len(self.playlist) - 1: self.currentplaying += 1 self.player.stop() self.player = GstPlayer(self.videowidget) @@ -127,7 +139,7 @@ class JukeboxActivity(activity.Activity): self.player.connect("stream-info", self._player_stream_info_cb) self.player.set_uri(self.playlist[self.currentplaying]) logging.info("NExt: " + self.playlist[self.currentplaying]) - self.playflag = True + #self.playflag = True self.play_toggled() self.player.connect("eos", self._player_eos_cb) else: -- cgit