updated code, external random video function
This commit is contained in:
parent
dd21b61197
commit
aba7738b4c
|
@ -29,56 +29,35 @@ if [ -z "$1" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
cameralist="~/birdcam/conf/cameralist.txt" ### var
|
||||
cameralist="~/birdcam/conf/cameralist.txt" ### var
|
||||
playerproc="vlc" ### var
|
||||
playerparam="--no-osd" ### var
|
||||
playerparam="--no-osd --play-and-exit" ### var
|
||||
streamurl="rtsp://$1:554/user=admin&password=&channel=1&stream=0.sdp?real_stream" ### var
|
||||
folder="/home/pi/Video" ### var
|
||||
|
||||
randomvideosh="/home/pi/birdcam/randomvideo.sh" ### var
|
||||
randomvideoproc="randomvideo.sh" ### var
|
||||
|
||||
if [ ! -z "$(pgrep $playerproc)" ]; then
|
||||
pkill $playerproc
|
||||
fi
|
||||
|
||||
if [ ! -z "$(pgrep $randomvideoproc)" ]; then
|
||||
pkill $randomvideoproc
|
||||
fi
|
||||
|
||||
if [ "$1" = "random" ]; then ### var
|
||||
|
||||
playerstat="$(pgrep $playerproc)"
|
||||
file="$(find "$folder" -maxdepth 1 -type f |sort -R |head -n1)"
|
||||
$randomvideosh
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# echo "$file"; sleep 10
|
||||
|
||||
if [ -z "$playerproc" ]; then
|
||||
$player_path $playerparam "$file"
|
||||
|
||||
else
|
||||
kill $playerstat
|
||||
$player_path $playerparam "$file"
|
||||
|
||||
fi
|
||||
|
||||
elif [ "$1" = "birdcam1" ]; then ### var
|
||||
|
||||
playerstat="$(pgrep $playerproc)"
|
||||
|
||||
if [ -z "$playerproc" ]; then
|
||||
$player_path $playerparam "$streamurl"
|
||||
|
||||
else
|
||||
kill $playerstat
|
||||
$player_path $playerparam "$streamurl"
|
||||
|
||||
fi
|
||||
if [ "$1" = "birdcam1" ]; then ### var
|
||||
$player_path $playerparam "$streamurl"
|
||||
|
||||
elif [ "$1" = "birdcam2" ]; then ### var
|
||||
|
||||
playerstat="$(pgrep $playerproc)"
|
||||
|
||||
if [ -z "$playerproc" ]; then
|
||||
$player_path $playerparam "$streamurl"
|
||||
|
||||
else
|
||||
kill $playerstat
|
||||
$player_path $playerparam "$streamurl"
|
||||
|
||||
fi
|
||||
$player_path $playerparam "$streamurl"
|
||||
|
||||
else
|
||||
echo "Wrong camera! Avaiable cameras:"
|
||||
echo "Wrong camera! Available cameras:"
|
||||
cat $cameralist
|
||||
|
||||
fi
|
Loading…
Reference in New Issue