]> git.parisson.com Git - piplayer.git/commitdiff
play until the end
authorGuillaume Pellerin <yomguy@parisson.com>
Tue, 23 Jul 2013 01:34:20 +0000 (03:34 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Tue, 23 Jul 2013 01:34:20 +0000 (03:34 +0200)
piplayer.py

index 593e19e2074d525fe42abc4665c5014a07afcea7..0dfd3726f75bd917c40756512d48c685932be690 100644 (file)
@@ -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