From: Calin Crisan Date: Sun, 6 Oct 2013 09:55:07 +0000 (+0300) Subject: added a motion running checker X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=38cfedda41ddd48df223d4ec0f4b0f583e240883;p=motioneye-debian added a motion running checker --- diff --git a/doc/todo.txt b/doc/todo.txt index 5a092c5..4219faa 100644 --- a/doc/todo.txt +++ b/doc/todo.txt @@ -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 diff --git a/motioneye.py b/motioneye.py index 995ec57..88570b8 100755 --- a/motioneye.py +++ b/motioneye.py @@ -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__':