From: Guillaume Pellerin Date: Tue, 23 Jul 2013 01:34:20 +0000 (+0200) Subject: play until the end X-Git-Tag: 0.3~30 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=c7a37d8300f134382e39e48207d48581a6614225;p=piplayer.git play until the end --- 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