Streamercheck (#91)

* streamer_install function

* recommend ustreamer
This commit is contained in:
paukstelis
2023-06-04 17:40:42 -04:00
committed by GitHub
parent 54ade627ef
commit 200800077d

View File

@@ -383,12 +383,12 @@ write_camera() {
$OCTOEXEC --basedir $OCTOCONFIG/.$INSTANCE config set plugins.classicwebcam.snapshot "http://localhost:$CAMPORT?action=snapshot"
if [ -z "$CAMHAPROXY" ]; then
$OCTOEXEC --basedir $OCTOCONFIG/.$INSTANCE config set plugins.classicwebcam.stream "http://$(hostname).local:$CAMPORT?action=stream"
$OCTOEXEC --basedir $OCTOCONFIG/.$INSTANCE config set plugins.classicwebcam.stream "http://$(hostname).local:$CAMPORT?action=stream"
else
$OCTOEXEC --basedir $OCTOCONFIG/.$INSTANCE config set plugins.classicwebcam.stream "/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
@@ -872,47 +872,8 @@ prepare () {
echo
echo
echo
PS3='Which video streamer you would like to install?: '
options=("mjpeg-streamer" "ustreamer" "None")
select opt in "${options[@]}"
do
case $opt in
"mjpeg-streamer")
VID=1
break
;;
"ustreamer")
VID=2
break
;;
"None")
break
;;
*) echo "invalid option $REPLY";;
esac
done
if [ $VID -eq 1 ]; then
echo 'streamer: mjpg-streamer' >> /etc/octoprint_deploy
#install mjpg-streamer, not doing any error checking or anything
echo 'Installing mjpeg-streamer'
sudo -u $user git clone https://github.com/jacksonliam/mjpg-streamer.git mjpeg
#apt -y install
sudo -u $user make -C mjpeg/mjpg-streamer-experimental > /dev/null
sudo -u $user mv mjpeg/mjpg-streamer-experimental /home/$user/mjpg-streamer
sudo -u $user rm -rf mjpeg
fi
if [ $VID -eq 2 ]; then
echo 'streamer: ustreamer' >> /etc/octoprint_deploy
#install ustreamer
sudo -u $user git clone --depth=1 https://github.com/pikvm/ustreamer
sudo -u $user make -C ustreamer > /dev/null
fi
if [ $VID -eq 3 ]; then
echo "Good for you! Cameras are just annoying anyway."
fi
streamer_install
#Fedora has SELinux on by default so must make adjustments? Don't really know what these do...
if [ $INSTALL -eq 3 ]; then
@@ -969,6 +930,66 @@ prepare () {
main_menu
}
streamer_install() {
PS3='Which video streamer you would like to install?: '
options=("mjpeg-streamer" "ustreamer (recommended)" "None")
select opt in "${options[@]}"
do
case $opt in
"mjpeg-streamer")
VID=1
break
;;
"ustreamer (recommended)")
VID=2
break
;;
"None")
break
;;
*) echo "invalid option $REPLY";;
esac
done
if [ $VID -eq 1 ]; then
#install mjpg-streamer, not doing any error checking or anything
echo 'Installing mjpeg-streamer'
sudo -u $user git clone https://github.com/jacksonliam/mjpg-streamer.git mjpeg
#apt -y install
sudo -u $user make -C mjpeg/mjpg-streamer-experimental > /dev/null
sudo -u $user mv mjpeg/mjpg-streamer-experimental /home/$user/mjpg-streamer
sudo -u $user rm -rf mjpeg
if [ -f "/home/$user/mjpg-streamer/mjpg_streamer" ]; then
echo "mjpg_streamer installed successfully"
echo 'streamer: mjpg-streamer' >> /etc/octoprint_deploy
else
echo "There was a problem installing the streamer. Please try again."
streamer_install
fi
fi
if [ $VID -eq 2 ]; then
#install ustreamer
sudo -u $user git clone --depth=1 https://github.com/pikvm/ustreamer
sudo -u $user make -C ustreamer > /dev/null
if [ -f "/home/$user/ustreamer/ustreamer" ]; then
echo "ustreamer installed successfully"
echo 'streamer: ustreamer' >> /etc/octoprint_deploy
else
echo "There was a problem installing the streamer. Please try again."
streamer_install
fi
fi
if [ $VID -eq 3 ]; then
echo "Good for you! Cameras are just annoying anyway."
fi
}
firstrun() {
echo
echo