From: Calin Crisan Date: Sun, 3 May 2015 12:50:35 +0000 (+0300) Subject: added --settings support X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=19c065d5379c937908f15ec1847f8b6eb206fee6;p=motioneye-debian added --settings support --- diff --git a/motioneye.py b/motioneye.py index c7e7129..ef752d9 100755 --- a/motioneye.py +++ b/motioneye.py @@ -17,6 +17,7 @@ # along with this program. If not, see . import datetime +import imp import inspect import logging import multiprocessing @@ -27,10 +28,15 @@ import sys from tornado.httpclient import AsyncHTTPClient -import settings +# test if a --settings directive has been supplied +for i in xrange(1, len(sys.argv) - 1): + if sys.argv[i] == '--settings': + settings_module = sys.argv[i + 1] + imp.load_source('settings', settings_module) -sys.path.append(os.path.join(getattr(settings, 'PROJECT_PATH', os.path.dirname(sys.argv[0])), 'src')) +sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), 'src')) +import settings import update VERSION = '0.24' @@ -270,6 +276,8 @@ def _print_help(): options = list(inspect.getmembers(settings)) + print(' --settings ') + for (name, value) in sorted(options): if name.upper() != name: continue