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')
# 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')
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)
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')
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)
ssid = s['wifiNetworkName']
psk = s['wifiNetworkKey']
+ # will update the first configured network
try:
conf_file = open(WPA_SUPPLICANT_CONF, 'r')
$('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')));
});
{% 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 %}