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