Classicwebcam (#89)

* modifications for classic webcam plugin

* restart prompt
This commit is contained in:
paukstelis
2023-05-24 13:27:31 -04:00
committed by GitHub
parent a07f98c98a
commit 726333ca0d

View File

@@ -380,14 +380,18 @@ write_camera() {
echo $CAMPORT >> /etc/camera_ports
#config.yaml modifications - only if INUM not set
if [ -z "$INUM" ]; then
echo "webcam:" >> $OCTOCONFIG/.$INSTANCE/config.yaml
echo " snapshot: http://$(hostname).local:$CAMPORT?action=snapshot" >> $OCTOCONFIG/.$INSTANCE/config.yaml
$OCTOEXEC --basedir $OCTOCONFIG/.$INSTANCE config plugins.classicwebcam.snapshot set "http://localhost:$CAMPORT?action=snapshot"
if [ -z "$CAMHAPROXY" ]; then
echo " stream: http://$(hostname).local:$CAMPORT?action=stream" >> $OCTOCONFIG/.$INSTANCE/config.yaml
$OCTOEXEC --basedir $OCTOCONFIG/.$INSTANCE config plugins.classicwebcam.stream set "http://$(hostname).local:$CAMPORT?action=stream"
else
echo " stream: /cam_$INSTANCE/?action=stream" >> $OCTOCONFIG/.$INSTANCE/config.yaml
$OCTOEXEC --basedir $OCTOCONFIG/.$INSTANCE config plugins.classicwebcam.stream set "/cam_$INSTANCE/?action=stream"
fi
$OCTOEXEC --basedir $OCTOCONFIG/.$INSTANCE config append_value --json system.actions "{\"action\": \"Reset video streamer\", \"command\": \"sudo systemctl restart cam_$INSTANCE\", \"name\": \"Restart webcam\"}"
if prompt_confirm "Instance must be restarted for settings to take effect. Restart now?"; then
systemctl restart $INSTANCE
fi
fi
#Either Serial number or USB port