Raspberry PI (all): streameye: use camera files instead of thread files

This commit is contained in:
Calin Crisan 2019-03-11 22:57:05 +02:00
parent 42cb0d0c35
commit adf81dea0d
8 changed files with 26 additions and 26 deletions

View File

@ -187,13 +187,13 @@ def _set_streameye_enabled(enabled):
config._camera_ids_cache = []
logging.debug('disabling all cameras in motion.conf')
cmd = 'sed -r -i "s/^thread (.*)/#thread \\1/" /data/etc/motion.conf &>/dev/null'
cmd = 'sed -r -i "s/^camera (.*)/#camera \\1/" /data/etc/motion.conf &>/dev/null'
if os.system(cmd):
logging.error('failed to disable cameras in motion.conf')
logging.debug('renaming thread files')
logging.debug('renaming camera files')
for name in os.listdir(settings.CONF_PATH):
if re.match('^thread-\d+.conf$', name):
if re.match('^camera-\d+.conf$', name):
os.rename(os.path.join(settings.CONF_PATH, name), os.path.join(settings.CONF_PATH, name + '.bak'))
logging.debug('adding simple mjpeg camera')
@ -231,9 +231,9 @@ def _set_streameye_enabled(enabled):
if camera_config.get('@proto') == 'mjpeg':
config.rem_camera(camera_id)
logging.debug('renaming thread files')
logging.debug('renaming camera files')
for name in os.listdir(settings.CONF_PATH):
if re.match('^thread-\d+.conf.bak$', name):
if re.match('^camera-\d+.conf.bak$', name):
os.rename(os.path.join(settings.CONF_PATH, name), os.path.join(settings.CONF_PATH, name[:-4]))
_streameye_enabled = False

View File

@ -6,11 +6,11 @@ MOTIONEYE_CONF_DIR="/data/etc/"
test -n "${OS_VERSION}" || source /etc/init.d/base
enabled() {
test $(ls -1 ${MOTIONEYE_CONF_DIR}/thread-*.conf 2>/dev/null| wc -l) == 1 || return 1
test $(ls -1 ${MOTIONEYE_CONF_DIR}/camera-*.conf 2>/dev/null| wc -l) == 1 || return 1
grep '# @proto mjpeg' ${MOTIONEYE_CONF_DIR}/thread-1.conf &>/dev/null || return 1
grep '# @proto mjpeg' ${MOTIONEYE_CONF_DIR}/camera-1.conf &>/dev/null || return 1
grep -E '# @url http://(.*)127.0.0.1:' ${MOTIONEYE_CONF_DIR}/thread-1.conf &>/dev/null || return 1
grep -E '# @url http://(.*)127.0.0.1:' ${MOTIONEYE_CONF_DIR}/camera-1.conf &>/dev/null || return 1
return 0
}

View File

@ -187,13 +187,13 @@ def _set_streameye_enabled(enabled):
config._camera_ids_cache = []
logging.debug('disabling all cameras in motion.conf')
cmd = 'sed -r -i "s/^thread (.*)/#thread \\1/" /data/etc/motion.conf &>/dev/null'
cmd = 'sed -r -i "s/^camera (.*)/#camera \\1/" /data/etc/motion.conf &>/dev/null'
if os.system(cmd):
logging.error('failed to disable cameras in motion.conf')
logging.debug('renaming thread files')
logging.debug('renaming camera files')
for name in os.listdir(settings.CONF_PATH):
if re.match('^thread-\d+.conf$', name):
if re.match('^camera-\d+.conf$', name):
os.rename(os.path.join(settings.CONF_PATH, name), os.path.join(settings.CONF_PATH, name + '.bak'))
logging.debug('adding simple mjpeg camera')
@ -231,9 +231,9 @@ def _set_streameye_enabled(enabled):
if camera_config.get('@proto') == 'mjpeg':
config.rem_camera(camera_id)
logging.debug('renaming thread files')
logging.debug('renaming camera files')
for name in os.listdir(settings.CONF_PATH):
if re.match('^thread-\d+.conf.bak$', name):
if re.match('^camera-\d+.conf.bak$', name):
os.rename(os.path.join(settings.CONF_PATH, name), os.path.join(settings.CONF_PATH, name[:-4]))
_streameye_enabled = False

View File

@ -6,11 +6,11 @@ MOTIONEYE_CONF_DIR="/data/etc/"
test -n "${OS_VERSION}" || source /etc/init.d/base
enabled() {
test $(ls -1 ${MOTIONEYE_CONF_DIR}/thread-*.conf 2>/dev/null| wc -l) == 1 || return 1
test $(ls -1 ${MOTIONEYE_CONF_DIR}/camera-*.conf 2>/dev/null| wc -l) == 1 || return 1
grep '# @proto mjpeg' ${MOTIONEYE_CONF_DIR}/thread-1.conf &>/dev/null || return 1
grep '# @proto mjpeg' ${MOTIONEYE_CONF_DIR}/camera-1.conf &>/dev/null || return 1
grep -E '# @url http://(.*)127.0.0.1:' ${MOTIONEYE_CONF_DIR}/thread-1.conf &>/dev/null || return 1
grep -E '# @url http://(.*)127.0.0.1:' ${MOTIONEYE_CONF_DIR}/camera-1.conf &>/dev/null || return 1
return 0
}

View File

@ -54,7 +54,7 @@ function start() {
function stop() {
# stop the streameye background watch process
ps | grep streameye.sh | grep -v $$ | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1 | xargs -r kill
ps | grep streameye.sh | grep -v $$ | grep -v S94streameye| grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1 | xargs -r kill
# stop the raspimjpeg process
pid=$(ps | grep raspimjpeg.py | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1)

View File

@ -187,13 +187,13 @@ def _set_streameye_enabled(enabled):
config._camera_ids_cache = []
logging.debug('disabling all cameras in motion.conf')
cmd = 'sed -r -i "s/^thread (.*)/#thread \\1/" /data/etc/motion.conf &>/dev/null'
cmd = 'sed -r -i "s/^camera (.*)/#camera \\1/" /data/etc/motion.conf &>/dev/null'
if os.system(cmd):
logging.error('failed to disable cameras in motion.conf')
logging.debug('renaming thread files')
logging.debug('renaming camera files')
for name in os.listdir(settings.CONF_PATH):
if re.match('^thread-\d+.conf$', name):
if re.match('^camera-\d+.conf$', name):
os.rename(os.path.join(settings.CONF_PATH, name), os.path.join(settings.CONF_PATH, name + '.bak'))
logging.debug('adding simple mjpeg camera')
@ -231,9 +231,9 @@ def _set_streameye_enabled(enabled):
if camera_config.get('@proto') == 'mjpeg':
config.rem_camera(camera_id)
logging.debug('renaming thread files')
logging.debug('renaming camera files')
for name in os.listdir(settings.CONF_PATH):
if re.match('^thread-\d+.conf.bak$', name):
if re.match('^camera-\d+.conf.bak$', name):
os.rename(os.path.join(settings.CONF_PATH, name), os.path.join(settings.CONF_PATH, name[:-4]))
_streameye_enabled = False

View File

@ -6,11 +6,11 @@ MOTIONEYE_CONF_DIR="/data/etc/"
test -n "${OS_VERSION}" || source /etc/init.d/base
enabled() {
test $(ls -1 ${MOTIONEYE_CONF_DIR}/thread-*.conf 2>/dev/null| wc -l) == 1 || return 1
test $(ls -1 ${MOTIONEYE_CONF_DIR}/camera-*.conf 2>/dev/null| wc -l) == 1 || return 1
grep '# @proto mjpeg' ${MOTIONEYE_CONF_DIR}/thread-1.conf &>/dev/null || return 1
grep '# @proto mjpeg' ${MOTIONEYE_CONF_DIR}/camera-1.conf &>/dev/null || return 1
grep -E '# @url http://(.*)127.0.0.1:' ${MOTIONEYE_CONF_DIR}/thread-1.conf &>/dev/null || return 1
grep -E '# @url http://(.*)127.0.0.1:' ${MOTIONEYE_CONF_DIR}/camera-1.conf &>/dev/null || return 1
return 0
}

View File

@ -54,7 +54,7 @@ function start() {
function stop() {
# stop the streameye background watch process
ps | grep streameye.sh | grep -v $$ | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1 | xargs -r kill
ps | grep streameye.sh | grep -v $$ | grep -v S94streameye| grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1 | xargs -r kill
# stop the raspimjpeg process
pid=$(ps | grep raspimjpeg.py | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1)