From 53b71c17727011c4f771e29877c3ccfd16398b6c Mon Sep 17 00:00:00 2001 From: mmaster Date: Tue, 21 Sep 2021 19:19:16 +0200 Subject: [PATCH] Add option for random video --- view_birdcam.sh | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/view_birdcam.sh b/view_birdcam.sh index 5720dea..080a645 100755 --- a/view_birdcam.sh +++ b/view_birdcam.sh @@ -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 \ No newline at end of file