From c7a37d8300f134382e39e48207d48581a6614225 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Tue, 23 Jul 2013 03:34:20 +0200 Subject: [PATCH] play until the end --- piplayer.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/piplayer.py b/piplayer.py index 593e19e..0dfd372 100644 --- a/piplayer.py +++ b/piplayer.py @@ -72,6 +72,7 @@ class AudioPlayer(object): osc_channel = 12345 gpio_channel = 22 + play = False def __init__(self, uri): self.uri = uri @@ -133,6 +134,7 @@ class AudioPlayer(object): def on_eos(self, bus, msg): #print 'on_eos' self.pipeline.set_state(gst.STATE_NULL) + self.play = False #self.mainloop.quit() def on_tag(self, bus, msg): @@ -155,9 +157,11 @@ class AudioPlayer(object): self.pipeline.set_state(gst.STATE_NULL) def gpio_play(self, value): - print 'play' - self.pipeline.set_state(gst.STATE_NULL) - self.pipeline.set_state(gst.STATE_PLAYING) + if not self.play: + print 'play' + self.pipeline.set_state(gst.STATE_NULL) + self.pipeline.set_state(gst.STATE_PLAYING) + self.play = True def update_uri(uri): self.uri = uri -- 2.39.5