some documentation

This commit is contained in:
mmaster 2021-09-21 23:05:25 +02:00
parent da9c3cd88c
commit d07d8378a8
4 changed files with 54 additions and 30 deletions

View File

@ -25,8 +25,8 @@ if [ -z "$gpiocmd" ]; then
fi
fi
player="vlc"
gpiopin_led_b="28"
player="vlc" ### var: player process
gpiopin_led_b="28" ### var: gpio led
$gpiocmd mode $gpiopin_led_b out
$gpiocmd write $gpiopin_led_b 0

View File

@ -25,16 +25,16 @@ if [ -z "$gpiocmd" ]; then
fi
fi
gpiopin_sw="0" ### var
gpiopin_led_r="2" ### var
gpiopin_led_g="29" ### var
gpiopin_sw="0" ### var: gpio switch
gpiopin_led_r="2" ### var: gpio led red
gpiopin_led_g="29" ### var: gpio led green
cameracmd="/home/pi/birdcam/view_birdcam.sh" ### var
cameracmd="/home/pi/birdcam/view_birdcam.sh" ### var: path to player script
buttonpolling="0.05" ### var: seconds
buttontimeout="1" ### var: seconds
countermax="1200" ### var: countermax=time/buttonpolling
buttonpolling="0.05" ### var: button polling in seconds
buttontimeout="1" ### var: button timeout in seconds
countermax="1200" ### var: counter max for automatic switching (countermax=time/buttonpolling)
$gpiocmd mode $gpiopin_led_g out
$gpiocmd write $gpiopin_led_g 0
@ -52,7 +52,7 @@ while true; do
$gpiocmd write $gpiopin_led_g 0
$gpiocmd mode $gpiopin_led_r in
camname="random" ### var
camname="random" ### var: parameter for random video
$cameracmd $camname &
echo "$camname started!"
sleep $buttontimeout
@ -68,7 +68,7 @@ while true; do
$gpiocmd write $gpiopin_led_g 0
$gpiocmd mode $gpiopin_led_r in
camname="birdcam1" ### var
camname="birdcam1" ### var: parameter for camera 1
$cameracmd $camname &
echo "$camname started!"
sleep $buttontimeout
@ -84,9 +84,9 @@ while true; do
$gpiocmd write $gpiopin_led_g 0
$gpiocmd mode $gpiopin_led_r in
camname="birdcam2" ### var
camname="birdcam2" ### var: parameter for camera 2
$cameracmd $camname &
echo "$camname started!"
sleep $buttontimeout
done
done

32
randomvideo.sh Normal file → Executable file
View File

@ -1,10 +1,34 @@
#!/bin/sh
folder="/home/pi/Video"
player="cvlc"
playerparam="--no-osd --play-and-exit"
folder="/home/pi/Video" ### var: path to video files
player="cvlc" ### var: player command
playerparam="--no-osd --play-and-exit" ### var: player parameters
player_path="$(command -v $player)"
player_package="vlc" ### var: player apt package
if [ -z "$player_path" ]; then
echo "Missing $player, try to install it ..."
echo "Check internet connection ..."
pingserver="raspbian.raspberrypi.org" ### var: pingcheck destination
if ! ping -q -c1 $pingserver>/dev/null; then
echo "No internet connection ..."
exit 0
fi
sudo apt-get update; sudo apt-get -y install $player_package
player_path="$(command -v $player)"
if [ -z "$player_path" ]; then
echo "Cannot install $player, exiting ..."
exit 0
fi
fi
while true; do
file="$(find "$folder" -maxdepth 1 -type f |sort -R |head -n1)"
$player $playerparam $file
done
done

View File

@ -1,8 +1,8 @@
#!/bin/sh
player="cvlc" ### var
player_path="$(command -v $player)" ### var
player_package="vlc" ### var
player="cvlc" ### var: player command
player_path="$(command -v $player)"
player_package="vlc" ### var: player apt package
if [ -z "$player_path" ]; then
echo "Missing $player, try to install it ..."
@ -29,13 +29,13 @@ if [ -z "$1" ]; then
exit 0
fi
cameralist="~/birdcam/conf/cameralist.txt" ### var
playerproc="vlc" ### var
playerparam="--no-osd --play-and-exit" ### var
streamurl="rtsp://$1:554/user=admin&password=&channel=1&stream=0.sdp?real_stream" ### var
cameralist="/home/pi/birdcam/conf/cameralist.txt" ### var: list of all cameras/commands file
playerproc="vlc" ### var: media player process name
playerparam="--no-osd --play-and-exit" ### var: media player parameters
streamurl="rtsp://$1:554/user=admin&password=&channel=1&stream=0.sdp?real_stream" ### var: camera stream url
randomvideosh="/home/pi/birdcam/randomvideo.sh" ### var
randomvideoproc="randomvideo.sh" ### var
randomvideosh="/home/pi/birdcam/randomvideo.sh" ### var: path to random video script
randomvideoproc="randomvideo.sh" ### var: name of process for random video script
if [ ! -z "$(pgrep $playerproc)" ]; then
pkill $playerproc
@ -45,19 +45,19 @@ if [ ! -z "$(pgrep $randomvideoproc)" ]; then
pkill $randomvideoproc
fi
if [ "$1" = "random" ]; then ### var
if [ "$1" = "random" ]; then
$randomvideosh
exit 0
fi
if [ "$1" = "birdcam1" ]; then ### var
if [ "$1" = "birdcam1" ]; then ### var: hostname camera1
$player_path $playerparam "$streamurl"
elif [ "$1" = "birdcam2" ]; then ### var
elif [ "$1" = "birdcam2" ]; then ### var: hostname camera2
$player_path $playerparam "$streamurl"
else
echo "Wrong camera! Available cameras:"
cat $cameralist
fi
fi