mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-25 20:26:34 +00:00
Raspberry PI (all): streameye: use camera files instead of thread files
This commit is contained in:
parent
42cb0d0c35
commit
adf81dea0d
@ -187,13 +187,13 @@ def _set_streameye_enabled(enabled):
|
|||||||
config._camera_ids_cache = []
|
config._camera_ids_cache = []
|
||||||
|
|
||||||
logging.debug('disabling all cameras in motion.conf')
|
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):
|
if os.system(cmd):
|
||||||
logging.error('failed to disable cameras in motion.conf')
|
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):
|
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'))
|
os.rename(os.path.join(settings.CONF_PATH, name), os.path.join(settings.CONF_PATH, name + '.bak'))
|
||||||
|
|
||||||
logging.debug('adding simple mjpeg camera')
|
logging.debug('adding simple mjpeg camera')
|
||||||
@ -231,9 +231,9 @@ def _set_streameye_enabled(enabled):
|
|||||||
if camera_config.get('@proto') == 'mjpeg':
|
if camera_config.get('@proto') == 'mjpeg':
|
||||||
config.rem_camera(camera_id)
|
config.rem_camera(camera_id)
|
||||||
|
|
||||||
logging.debug('renaming thread files')
|
logging.debug('renaming camera files')
|
||||||
for name in os.listdir(settings.CONF_PATH):
|
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]))
|
os.rename(os.path.join(settings.CONF_PATH, name), os.path.join(settings.CONF_PATH, name[:-4]))
|
||||||
|
|
||||||
_streameye_enabled = False
|
_streameye_enabled = False
|
||||||
|
@ -6,11 +6,11 @@ MOTIONEYE_CONF_DIR="/data/etc/"
|
|||||||
test -n "${OS_VERSION}" || source /etc/init.d/base
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
enabled() {
|
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
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -187,13 +187,13 @@ def _set_streameye_enabled(enabled):
|
|||||||
config._camera_ids_cache = []
|
config._camera_ids_cache = []
|
||||||
|
|
||||||
logging.debug('disabling all cameras in motion.conf')
|
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):
|
if os.system(cmd):
|
||||||
logging.error('failed to disable cameras in motion.conf')
|
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):
|
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'))
|
os.rename(os.path.join(settings.CONF_PATH, name), os.path.join(settings.CONF_PATH, name + '.bak'))
|
||||||
|
|
||||||
logging.debug('adding simple mjpeg camera')
|
logging.debug('adding simple mjpeg camera')
|
||||||
@ -231,9 +231,9 @@ def _set_streameye_enabled(enabled):
|
|||||||
if camera_config.get('@proto') == 'mjpeg':
|
if camera_config.get('@proto') == 'mjpeg':
|
||||||
config.rem_camera(camera_id)
|
config.rem_camera(camera_id)
|
||||||
|
|
||||||
logging.debug('renaming thread files')
|
logging.debug('renaming camera files')
|
||||||
for name in os.listdir(settings.CONF_PATH):
|
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]))
|
os.rename(os.path.join(settings.CONF_PATH, name), os.path.join(settings.CONF_PATH, name[:-4]))
|
||||||
|
|
||||||
_streameye_enabled = False
|
_streameye_enabled = False
|
||||||
|
@ -6,11 +6,11 @@ MOTIONEYE_CONF_DIR="/data/etc/"
|
|||||||
test -n "${OS_VERSION}" || source /etc/init.d/base
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
enabled() {
|
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
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ function start() {
|
|||||||
|
|
||||||
function stop() {
|
function stop() {
|
||||||
# stop the streameye background watch process
|
# 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
|
# stop the raspimjpeg process
|
||||||
pid=$(ps | grep raspimjpeg.py | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1)
|
pid=$(ps | grep raspimjpeg.py | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1)
|
||||||
|
@ -187,13 +187,13 @@ def _set_streameye_enabled(enabled):
|
|||||||
config._camera_ids_cache = []
|
config._camera_ids_cache = []
|
||||||
|
|
||||||
logging.debug('disabling all cameras in motion.conf')
|
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):
|
if os.system(cmd):
|
||||||
logging.error('failed to disable cameras in motion.conf')
|
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):
|
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'))
|
os.rename(os.path.join(settings.CONF_PATH, name), os.path.join(settings.CONF_PATH, name + '.bak'))
|
||||||
|
|
||||||
logging.debug('adding simple mjpeg camera')
|
logging.debug('adding simple mjpeg camera')
|
||||||
@ -231,9 +231,9 @@ def _set_streameye_enabled(enabled):
|
|||||||
if camera_config.get('@proto') == 'mjpeg':
|
if camera_config.get('@proto') == 'mjpeg':
|
||||||
config.rem_camera(camera_id)
|
config.rem_camera(camera_id)
|
||||||
|
|
||||||
logging.debug('renaming thread files')
|
logging.debug('renaming camera files')
|
||||||
for name in os.listdir(settings.CONF_PATH):
|
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]))
|
os.rename(os.path.join(settings.CONF_PATH, name), os.path.join(settings.CONF_PATH, name[:-4]))
|
||||||
|
|
||||||
_streameye_enabled = False
|
_streameye_enabled = False
|
||||||
|
@ -6,11 +6,11 @@ MOTIONEYE_CONF_DIR="/data/etc/"
|
|||||||
test -n "${OS_VERSION}" || source /etc/init.d/base
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
enabled() {
|
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
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ function start() {
|
|||||||
|
|
||||||
function stop() {
|
function stop() {
|
||||||
# stop the streameye background watch process
|
# 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
|
# stop the raspimjpeg process
|
||||||
pid=$(ps | grep raspimjpeg.py | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1)
|
pid=$(ps | grep raspimjpeg.py | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user