]> git.parisson.com Git - piplayer.git/commitdiff
add OSC pause mode, fix OSC stop dev 0.3.1
authorGuillaume Pellerin <yomguy@parisson.com>
Thu, 24 Oct 2013 17:38:58 +0000 (19:38 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Thu, 24 Oct 2013 17:38:58 +0000 (19:38 +0200)
piplayer/player.py
tools/osc_stop.py

index 7fab4972a37930b3fbc2b1c7e109c713cabf564c..74e75776dda8f01fb7edb2a83050cc80827837f8 100644 (file)
@@ -57,8 +57,8 @@ class PiPlayer(object):
         
         # OSC controller
         self.osc_controller = OSCController(self.osc_port)
-        self.osc_controller.add_method('/play', 'i', self.osc_play_stop)
-        self.osc_controller.add_method('/stop', 'i', self.osc_play_stop)
+        self.osc_controller.add_method('/play', 'i', self.osc_play_pause)
+        self.osc_controller.add_method('/stop', 'i', self.osc_stop)
         self.osc_controller.start()
  
         # GPIO controller
@@ -174,11 +174,21 @@ class PiPlayer(object):
             self.pipeline.set_state(gst.STATE_NULL)
             self.playing = False
 
-    def osc_play_stop(self, path, value):
+    def pause(self):
+        if self.playing:
+            self.pipeline.set_state(gst.STATE_PAUSED)
+            self.playing = False
+            
+    def osc_play_pause(self, path, value):
         value = value[0]
         if value and not self.playing:
             self.play()
         else:
+            self.pause()
+
+    def osc_stop(self, path, value):
+        value = value[0]
+        if value and self.playing:
             self.stop()
             
     def gpio_play(self, channel):
index cce33148cac31907c6b155471893852341013af8..acb1ea157e93d1abe3557e557f6440007abfc1a7 100644 (file)
@@ -11,4 +11,4 @@ except liblo.AddressError, err:
     sys.exit()
 
 # send message "/foo/message1" with int, float and string arguments
-liblo.send(target, "/play", 0)
+liblo.send(target, "/stop", 1)