view_birdcam.sh uses vars-file
This commit is contained in:
parent
fc7bbf69e3
commit
2b52d5d7ae
12
vars
12
vars
|
@ -2,10 +2,13 @@
|
|||
playercmd=cvlc
|
||||
playerparam=--no-osd --play-and-quit
|
||||
playerproc=vlc
|
||||
playerpackage=
|
||||
playerpackage=vlc
|
||||
randomsh=randomvideo.sh
|
||||
pingserver=raspbian.raspberrypi.org
|
||||
usbdevice=sda1
|
||||
camparamr=random
|
||||
camparam1=birdcam1
|
||||
camparam2=birdcam2
|
||||
|
||||
# automount.sh
|
||||
mountpoint=/media/video
|
||||
|
@ -22,11 +25,12 @@ camerash=/home/pi/birdcam/view_birdcam.sh
|
|||
buttonpolling=0.05
|
||||
buttontimeout=1
|
||||
countermax=1200
|
||||
camparamr=random
|
||||
camparam1=birdcam1
|
||||
camparam2=birdcam2
|
||||
|
||||
# randomvideo.sh
|
||||
folderext=/media/video/video
|
||||
folderint=/home/pi/birdcam/video
|
||||
|
||||
# view_birdcam.sh
|
||||
cameralist=/home/pi/birdcam/conf/cameralist.txt
|
||||
streamurl=rtsp://$1:554/user=admin&password=&channel=1&stream=0.sdp?real_stream
|
||||
randompathsh=/home/pi/birdcam/randomvideo.sh
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
player="cvlc" ### var: player command
|
||||
player="$(cat $vars | grep playercmd | cut -d'=' -f2)"
|
||||
player_path="$(command -v $player)"
|
||||
player_package="vlc" ### var: player apt package
|
||||
player_package="$(cat $vars | grep playerpackage | cut -d'=' -f2)"
|
||||
|
||||
if [ -z "$player_path" ]; then
|
||||
echo "Missing $player, try to install it ..."
|
||||
|
||||
echo "Check internet connection ..."
|
||||
pingserver="raspbian.raspberrypi.org" ### var: pingcheck destination
|
||||
pingserver="$(cat $vars | grep pingserver | cut -d'=' -f2)"
|
||||
if ! ping -q -c1 $pingserver>/dev/null; then
|
||||
echo "No internet connection ..."
|
||||
exit 0
|
||||
|
@ -29,13 +29,13 @@ if [ -z "$1" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
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
|
||||
cameralist="$(cat $vars | grep cameralist | cut -d'=' -f2)"
|
||||
playerproc="$(cat $vars | grep playerproc | cut -d'=' -f2)"
|
||||
playerparam="$(cat $vars | grep playerparam | cut -d'=' -f2)"
|
||||
streamurl="$(cat $vars | grep streamurl | cut -d'=' -f2)"
|
||||
|
||||
randomvideosh="/home/pi/birdcam/randomvideo.sh" ### var: path to random video script
|
||||
randomvideoproc="randomvideo.sh" ### var: name of process for random video script
|
||||
randomvideosh="$(cat $vars | grep randompathsh | cut -d'=' -f2)"
|
||||
randomvideoproc="$(cat $vars | grep randomsh | cut -d'=' -f2)"
|
||||
|
||||
if [ -n "$(pgrep $playerproc)" ]; then
|
||||
pkill $playerproc
|
||||
|
@ -45,15 +45,15 @@ if [ -n "$(pgrep $randomvideoproc)" ]; then
|
|||
pkill $randomvideoproc
|
||||
fi
|
||||
|
||||
if [ "$1" = "random" ]; then
|
||||
if [ "$1" = "$(cat $vars | grep camparamr | cut -d'=' -f2)" ]; then
|
||||
$randomvideosh
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "birdcam1" ]; then ### var: hostname camera1
|
||||
if [ "$1" = "$(cat $vars | grep camparam1 | cut -d'=' -f2)" ]; then
|
||||
$player_path $playerparam "$streamurl"
|
||||
|
||||
elif [ "$1" = "birdcam2" ]; then ### var: hostname camera2
|
||||
elif [ "$1" = "$(cat $vars | grep camparam2 | cut -d'=' -f2)" ]; then
|
||||
$player_path $playerparam "$streamurl"
|
||||
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue