Handle KeyboardInterrupt in the main program, not in the Player class
authorAntonio Ospite <ao2@ao2.it>
Mon, 28 Nov 2016 12:35:58 +0000 (13:35 +0100)
committerAntonio Ospite <ao2@ao2.it>
Mon, 28 Nov 2016 12:37:30 +0000 (13:37 +0100)
vidi-player.py
vidi/Player.py

index 04c8941..62ae575 100755 (executable)
@@ -105,7 +105,11 @@ def main():
     if len(sys.argv) > 3:
         timeline.save(sys.argv[3])
     else:
-        timeline.play()
+        try:
+            timeline.play()
+        except KeyboardInterrupt:
+            timeline.stop()
+            return 1
 
 
 if __name__ == "__main__":
index 58c3ece..15a4d07 100755 (executable)
@@ -51,11 +51,4 @@ class Player(object):
 
     def play(self):
         self.pipeline.set_state(Gst.State.PLAYING)
-
-        try:
-            self.mainloop.run()
-        except KeyboardInterrupt:
-            self.stop()
-            return 1
-
-        return 0
+        self.mainloop.run()