]> www.vanbest.org Git - motioneye-debian/commitdiff
added --settings support
authorCalin Crisan <ccrisan@gmail.com>
Sun, 3 May 2015 12:50:35 +0000 (15:50 +0300)
committerCalin Crisan <ccrisan@gmail.com>
Sun, 3 May 2015 12:50:35 +0000 (15:50 +0300)
motioneye.py

index c7e71293fa3c577cd460b6fc670209150df3a4d3..ef752d919b7233c1fed02b6ededc08d5200f07c8 100755 (executable)
@@ -17,6 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>. 
 
 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 <module>')
+    
     for (name, value) in sorted(options):
         if name.upper() != name:
             continue