]> www.vanbest.org Git - motioneye-debian/commitdiff
added support for custom motion binary setting
authorCalin Crisan <ccrisan@gmail.com>
Thu, 26 Feb 2015 17:56:02 +0000 (19:56 +0200)
committerCalin Crisan <ccrisan@gmail.com>
Thu, 26 Feb 2015 18:51:01 +0000 (20:51 +0200)
motioneye.py
settings_default.py
src/motionctl.py
src/wifictl.py
static/js/main.js
templates/main.html

index 915ba8b2b553dca97cad212364ba1d75bf9f8365..089e7e096aaf64f61a6ac2b606ddf6c4d3343df8 100755 (executable)
@@ -45,6 +45,7 @@ def _configure_settings():
     set_default_setting('RUN_PATH', os.path.join(settings.PROJECT_PATH, 'run'))
     set_default_setting('LOG_PATH', os.path.join(settings.PROJECT_PATH, 'log'))
     set_default_setting('MEDIA_PATH', os.path.join(settings.PROJECT_PATH, 'media'))
+    set_default_setting('MOTION_BINARY', None)
     set_default_setting('REPO', None)
     set_default_setting('LOG_LEVEL', logging.INFO)
     set_default_setting('LISTEN', '0.0.0.0')
index 948a33775ce563ffccdceda91305e76584b995a5..50f708d7a46f798a892edc7413c7466393e8123b 100644 (file)
@@ -23,6 +23,9 @@ LOG_PATH = os.path.abspath(os.path.join(PROJECT_PATH, 'log'))
 # default output path for media files
 MEDIA_PATH = os.path.abspath(os.path.join(PROJECT_PATH, 'media'))
 
+# path to motion binary (automatically detected if not set)
+MOTION_BINARY = None 
+
 # repository details for software updating
 REPO = ('ccrisan', 'motioneye')
 
index b55ea3a0bb9c06f3f345d74c5f98da519c04ca65..c910b93233b8d00a8e52699d8348a132aa7d325e 100644 (file)
@@ -39,12 +39,20 @@ def find_motion():
     global _motion_binary_cache
     if _motion_binary_cache:
         return _motion_binary_cache
-
-    try:
-        binary = subprocess.check_output('which motion', shell=True).strip()
     
-    except subprocess.CalledProcessError: # not found
-        return None
+    if settings.MOTION_BINARY:
+        if os.path.exists(settings.MOTION_BINARY):
+            binary = settings.MOTION_BINARY
+        
+        else:
+            return None
+
+    else: # autodetect motion binary path
+        try:
+            binary = subprocess.check_output('which motion', shell=True).strip()
+        
+        except subprocess.CalledProcessError: # not found
+            return None
 
     try:
         help = subprocess.check_output(binary + ' -h || true', shell=True)
@@ -87,6 +95,8 @@ def start():
     
     program, version = program  # @UnusedVariable
     
+    logging.debug('using motion binary "%s"' % program)
+
     motion_config_path = os.path.join(settings.CONF_PATH, 'motion.conf')
     motion_log_path = os.path.join(settings.LOG_PATH, 'motion.log')
     motion_pid_path = os.path.join(settings.RUN_PATH, 'motion.pid')
index ad3f8e6721e95f8f011947fc2a95c0037b4020e8..0890b432f422265e3bb6cf28c586c64930c060ca 100644 (file)
@@ -89,7 +89,9 @@ def _get_wifi_settings():
 
 
 def _set_wifi_settings(s):
-    # will update the first configured network
+    s.setdefault('wifiEnabled', False)
+    s.setdefault('wifiNetworkName', '')
+    s.setdefault('wifiNetworkKey', '')
     
     logging.debug('writing wifi settings to %s' % WPA_SUPPLICANT_CONF)
     
@@ -97,6 +99,7 @@ def _set_wifi_settings(s):
     ssid = s['wifiNetworkName']
     psk = s['wifiNetworkKey']
     
+    # will update the first configured network
     try:
         conf_file = open(WPA_SUPPLICANT_CONF, 'r')
     
index 9b8691e0ee8e50d34b6831053a9544eaa72b5e02..c45a19a8c7435c0642c99865b1ba585052b916e0 100644 (file)
@@ -482,7 +482,7 @@ function initUI() {
     $('input[type=text].number').each(function () {
         var $this = $(this);
         var $tr = $this.parent().parent();
-        makeTextValidator($this, Number($tr.attr('min')), Number($tr.attr('max')),
+        makeNumberValidator($this, Number($tr.attr('min')), Number($tr.attr('max')),
                 Boolean($tr.attr('floating')), Boolean($tr.attr('sign')), Boolean($tr.attr('required')));
     });
 
index 75466b5cca283599c137d50ec9a598068684e964..2962911de9fd59c468add7169967ccbb7e0bcc8d 100644 (file)
@@ -7,7 +7,7 @@
             {% if config.get('strip') %}strip="true"{% endif %}
             {% if config.get('depends') %}depends="{{' '.join(config['depends'])}}"{% endif %}
             {% if config.get('min') is not none %}min="{{config['min']}}"{% endif %}
-            {% if config.get('max') is not none %}max="{{config['min']}}"{% endif %}
+            {% if config.get('max') is not none %}max="{{config['max']}}"{% endif %}
             {% if config.get('floating') %}floating="true"{% endif %}
             {% if config.get('sign') %}sign="true"{% endif %}
             {% if config.get('snap') is not none %}snap="{{config['snap']}}"{% endif %}