]> www.vanbest.org Git - motioneye-debian/commitdiff
added a motion running checker
authorCalin Crisan <ccrisan@gmail.com>
Sun, 6 Oct 2013 09:55:07 +0000 (12:55 +0300)
committerCalin Crisan <ccrisan@gmail.com>
Sun, 6 Oct 2013 09:55:07 +0000 (12:55 +0300)
doc/todo.txt
motioneye.py

index 5a092c577efe203a3662a00e789ff7140cb99c90..4219faad3e6e54239c5d5103ad848433fe2cce45 100644 (file)
@@ -1,5 +1,4 @@
 -> add a motion running status indicator (and maybe a start/stop button)
--> add a timeout checker to check the running status of motion
 
 -> better ajax error handling
 -> add a messaging mechanism
index 995ec570d44ab46e59fb8bda3b9ed31af6176709..88570b80e0b983b87b108fec3f3d69673840781d 100755 (executable)
@@ -1,5 +1,6 @@
 #!/usr/bin/env python2
 
+import datetime
 import inspect
 import logging
 import os.path
@@ -126,9 +127,16 @@ def _start_motion():
     import config
     import motionctl
 
-    if not motionctl.running() and config.has_enabled_cameras():
-        motionctl.start()
-        logging.info('motion started')
+    # add a motion running checker
+    def checker():
+        if not motionctl.running() and config.has_enabled_cameras():
+            motionctl.start()
+            logging.info('motion started')
+
+        ioloop = tornado.ioloop.IOLoop.instance()
+        ioloop.add_timeout(datetime.timedelta(seconds=10), checker)
+    
+    checker()
 
 
 if __name__ == '__main__':