Add option for random video

This commit is contained in:
mmaster 2021-09-21 19:19:16 +02:00
parent 1ea8f5d3c6
commit 53b71c1772
1 changed files with 19 additions and 2 deletions

View File

@ -33,8 +33,25 @@ cameralist="~/birdcam/conf/cameralist.txt" ### var
playerproc="vlc" ### var
playerparam="--no-osd" ### var
streamurl="rtsp://$1:554/user=admin&password=&channel=1&stream=0.sdp?real_stream" ### var
folder="/home/pi/Video" ### var
if [ "$1" = "birdcam1" ]; then ### var
if [ "$1" = "random" ]; then ### var
playerstat="$(pgrep $playerproc)"
file="$(find "$folder" -maxdepth 1 -type f |sort -R |head -n1)"
# 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)"
@ -64,4 +81,4 @@ else
echo "Wrong camera! Avaiable cameras:"
cat $cameralist
fi
fi