]> www.vanbest.org Git - motioneye-debian/commitdiff
conf and run path are now configurable
authorCalin Crisan <ccrisan@gmail.com>
Sun, 29 Sep 2013 08:26:14 +0000 (11:26 +0300)
committerCalin Crisan <ccrisan@gmail.com>
Sun, 29 Sep 2013 08:26:14 +0000 (11:26 +0300)
doc/todo.txt
settings.py
src/config.py
src/motionctl.py
static/js/base-site.js

index 625387c5aa5dc4ab47e70b488d9fc31ce980d0d1..2ff1d97d5e0b935d2d9ff2da6f89a15f1d43268e 100644 (file)
@@ -1,5 +1,4 @@
 -> group @config rules to top
--> motion conf and run dirs should be configurable in settings
 -> browser compatibility test
 -> requirements test
 -> hint text next to section titles
index 1278a2a345ecdd70c2e570db798f73bf0c804fd6..6eeb272d01f2cb00af03a77e2574fddc4382f94b 100644 (file)
@@ -5,7 +5,7 @@ import sys
 
 
 PROJECT_PATH = os.path.dirname(sys.argv[0])
-CONF_PATH = os.path.join(PROJECT_PATH, 'conf') # TODO use this
+CONF_PATH = os.path.join(PROJECT_PATH, 'conf')
 RUN_PATH = PROJECT_PATH
 
 DEBUG = True
index c5c192347623e3e2757ea1bf351377cabb50f83d..86273d0fc916137e3377fa8aa2c5acec3743c954 100644 (file)
@@ -9,11 +9,10 @@ from collections import OrderedDict
 import settings
 
 
-_CONFIG_DIR = 'conf'
 _CAMERA_CONFIG_FILE_NAME = 'thread-%(id)s.conf'
 
-_MAIN_CONFIG_FILE_PATH = os.path.join(_CONFIG_DIR, 'motion.conf')
-_CAMERA_CONFIG_FILE_PATH = os.path.join(_CONFIG_DIR, _CAMERA_CONFIG_FILE_NAME)
+_MAIN_CONFIG_FILE_PATH = os.path.join(settings.CONF_PATH, 'motion.conf')
+_CAMERA_CONFIG_FILE_PATH = os.path.join(settings.CONF_PATH, _CAMERA_CONFIG_FILE_NAME)
 
 
 def get_main(as_lines=False):
@@ -107,7 +106,7 @@ def set_main(data):
 
 
 def get_camera_ids():
-    config_path = os.path.join(settings.PROJECT_PATH, _CONFIG_DIR)
+    config_path = settings.CONF_PATH
     
     logging.debug('listing config dir %(path)s...' % {'path': config_path})
     
index 69d3082623e1dace174bc6a5bafa2044eb1a6072..0ee23ec8701c9b09e8d7ebcfc5b8613fa64797f0 100644 (file)
@@ -18,7 +18,7 @@ def start():
     if not program:
         raise Exception('motion executable could not be found')
     
-    motion_config_path = os.path.join(settings.PROJECT_PATH, 'conf', 'motion.conf') # TODO conf path should be configurable
+    motion_config_path = os.path.join(settings.CONF_PATH, 'motion.conf')
     motion_log_path = os.path.join(settings.RUN_PATH, 'motion.log')
     motion_pid_path = os.path.join(settings.RUN_PATH, 'motion.pid')
     
index 61a9787bb2333f1400ec152f7b2dccdfb33a9544..bd3ab378da3c3ac87d9a5ab9bbf65346fc3dc6f7 100644 (file)
@@ -2,7 +2,7 @@
 var pushConfigs = {};
 
 
-    /* Ajax */
+    /* utils */
 
 function ajax(method, url, data, callback) {
     var options = {
@@ -27,6 +27,44 @@ function ajax(method, url, data, callback) {
     $.ajax(options);
 }
 
+Object.keys = Object.keys || (function () {
+    var hasOwnProperty = Object.prototype.hasOwnProperty;
+    var hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString');
+    var dontEnums = [
+        'toString',
+        'toLocaleString',
+        'valueOf',
+        'hasOwnProperty',
+        'isPrototypeOf',
+        'propertyIsEnumerable',
+        'constructor'
+    ];
+    var dontEnumsLength = dontEnums.length;
+
+    return function (obj) {
+        if (typeof obj !== 'object' && typeof obj !== 'function' || obj === null) {
+            return [];
+        }
+
+        var result = [];
+        for (var prop in obj) {
+            if (hasOwnProperty.call(obj, prop)) {
+                result.push(prop);
+            }
+        }
+
+        if (hasDontEnumBug) {
+            for (var i = 0; i < dontEnumsLength; i++) {
+                if (hasOwnProperty.call(obj, dontEnums[i])) {
+                    result.push(dontEnums[i]);
+                }
+            }
+        }
+        
+        return result;
+    };
+})();
+
 
     /* UI */
 
@@ -478,7 +516,7 @@ function showApply() {
     applyButton.html('Apply');
     applyButton.css('display', 'inline-block');
     applyButton.animate({'opacity': '1'}, 100);
-    applyButton.removeClass('inactive');
+    applyButton.removeClass('progress');
 }
 
 function showProgress() {
@@ -529,7 +567,12 @@ function doApply() {
     
     function testReady() {
         if (finishedCount >= configs.length) {
-            hideApply();
+            if (Object.keys(pushConfigs).length === 0) {
+                hideApply();
+            }
+            else {
+                showApply();
+            }
         }
     }