forked from Chaosbit/bigscreenpi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvideoplayer.sh
57 lines (47 loc) · 1.18 KB
/
videoplayer.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
PLAYER=omxplayer
OPTIONS='-rb --no-osd -o hdmi'
#Hier liegen die Videos
VIDEOPATH=/var/video
LOG='/var/log/video.log'
PAUSENVIDEO=/var/video/SNR_Pausenstueck_1min.mp4
#Extra Zeit zur Videolaenge
EXTRATIME=3
setterm -blank off -powerdown off > /dev/tty0
clear > /dev/tty0
setterm -cursor off > /dev/tty0
#Funktion zum Abspielen der Videos
playvideo() {
#Laenge Video ermitteln
string=$($PLAYER --info $VIDEO 2>&1 | sed -nr 's/.*(Duration:) ([0123456789:]+).*/\1\2/p')
var=$(echo $string | awk -F":" '{print $1,$2,$3,$4}')
set -- $var
#Sekunden für das Video berechnen
waittime=`expr $2 \* 3600 + $3 \* 60 + $4 + $EXTRATIME`
#echo $waittime
#Video starten
$PLAYER $OPTIONS $VIDEO &
#echo $!
sleep $waittime
#Checken ob noch ein omxplayer prozess laeuft
if ps ax | grep -v grep | grep $PLAYER > /dev/null
then
#omxplayer killen
echo 'still running; killing proc' >> $LOG
killall -I $PLAYER > /dev/null
killall -I $PLAYER.bin > /dev/null
else
echo 'ok' >> $LOG
fi
clear > /dev/tty0
}
#Tu Videos abspielen
while :
do
for file in $VIDEOPATH/active*.mkv; do
VIDEO=$file
playvideo
VIDEO=$PAUSENVIDEO
playvideo
done
done