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