#static_url '/static/'
# path to the configuration directory (must be writable by motionEye)
-conf_path /etc/motioneye
+#conf_path /etc/motioneye
# path to the directory where pid files go (must be writable by motionEye)
#run_path /var/run
hostname=socket.gethostname(),
title=self.get_argument('title', None),
admin_username=config.get_main().get('@admin_username'),
- old_motion=config.is_old_motion())
+ old_motion=config.is_old_motion(),
+ has_motion=bool(motionctl.find_motion()))
class ConfigHandler(BaseHandler):
self.finish_json({'error': error})
else:
- cameras = [c for c in cameras if c.get('enabled')]
self.finish_json({'cameras': cameras})
remote.list(self.get_data(), on_response)
def find_ffmpeg():
try:
- return subprocess.check_output('which ffmpeg', shell=True).strip()
+ return subprocess.check_output('which ffmpeg', stderr=open('/dev/null'), shell=True).strip()
except subprocess.CalledProcessError: # not found
return None
def configure_logging(cmd, log_to_file=False):
if log_to_file or cmd != 'motioneye':
- format = '%(asctime)s: [{cmd}] %(levelname)s: %(message)s'.format(cmd=cmd)
+ format = '%(asctime)s: [{cmd}] %(levelname)7s: %(message)s'.format(cmd=cmd)
else:
- format = '%(levelname)s: %(message)s'.format(cmd=cmd)
+ format = '%(levelname)7s: %(message)s'.format(cmd=cmd)
for h in logging.getLogger().handlers:
logging.getLogger().removeHandler(h)
else: # autodetect motion binary path
try:
- binary = subprocess.check_output('which motion', shell=True).strip()
+ binary = subprocess.check_output('which motion', stderr=open('/dev/null'), shell=True).strip()
except subprocess.CalledProcessError: # not found
return None
request = _make_request(scheme, host, port, username, password, uri + '/config/list/')
def on_response(response):
+ def make_camera_response(c):
+ return {
+ 'id': c['id'],
+ 'name': c['name']
+ }
+
if response.error:
logging.error('failed to list remote cameras on %(url)s: %(msg)s' % {
'url': pretty_camera_url(local_config, camera=False),
cameras = response['cameras']
# filter out simple mjpeg cameras
- cameras = [c for c in cameras if c['proto'] != 'mjpeg']
+ cameras = [make_camera_response(c) for c in cameras
+ if c['proto'] != 'mjpeg' and c.get('enabled')]
callback(cameras)
sys.exit(-1)
if not has_ffmpeg:
- logging.info('ffmpeg not installed')
+ if has_motion:
+ logging.warn('you have motion installed, but no ffmpeg')
+
+ else:
+ logging.info('ffmpeg not installed')
if not has_motion:
logging.info('motion not installed')
import tornado.ioloop
configure_signals()
- test_requirements()
-
logging.info('hello! this is motionEye server %s' % motioneye.VERSION)
+ test_requirements()
+
if settings.SMB_SHARES:
stop, start = smbctl.update_mounts() # @UnusedVariable
'<tr>' +
'<td class="dialog-item-label"><span class="dialog-item-label">Camera Type</span></td>' +
'<td class="dialog-item-value"><select class="styled" id="typeSelect">' +
- '<option value="v4l2">Local Camera</option>' +
- '<option value="netcam">Network Camera</option>' +
+ (hasLocalCamSupport ? '<option value="v4l2">Local Camera</option>' : '') +
+ (hasNetCamSupport ? '<option value="netcam">Network Camera</option>' : '') +
'<option value="motioneye">Remote motionEye Camera</option>' +
'<option value="mjpeg">Simple MJPEG Camera</option>' +
'</select></td>' +
urlEntry.change(updateUi);
usernameEntry.change(updateUi);
passwordEntry.change(updateUi);
- updateUi();
runModalDialog({
title: 'Add Camera...',
});
}
});
+
+ updateUi();
}
function runTimelapseDialog(cameraId, groupKey, group) {
var adminUsername = '{{admin_username}}';
var frame = {% if frame %}true{% else %}false{% endif %};
var baseUri = null;
+ var hasLocalCamSupport = {% if has_motion %}true{% else %}false{% endif %};
+ var hasNetCamSupport = {% if has_motion %}true{% else %}false{% endif %};
</script>
{% endblock %}