ubuntuusers.de

Anhang: Zapping.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
#!/bin/bash
# Script to change TV-stations using VLC from TV-Browser
# Autor Heinrich Schwietering (c) 2009, 2011
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.#

DISPLAY=:0.0
PLAYER=/usr/bin/vlc
## Umformen der Daten aus der channels.conf für vlc
echo `cat ~/.mplayer/channels.conf | grep "${1}:****"`  &> /tmp/SenderPID
FRQ=`cat /tmp/SenderPID | cut -d ":" -f 2 `
BNDW=`awk -F ":" '{print $4}' /tmp/SenderPID | awk -F "_" '{print $2}'`
PRG=`cat /tmp/SenderPID | cut -d ":" -f 13 ` && rm /tmp/SenderPID

## Check, ob Sendung schon angefangen, wenn nicht Erstellung eines at-Jobs, der
## zur Sendungsbeginn ein ggf. von Zapping.sh. gestartete Instanz beendet und dann neu startet
if [ ${2} -gt $(date +%s) ]; then
begin=`date -d "1970-01-01 UTC ${2} seconds" +"%H:%M %d.%m.%Y"` 
(echo kill \`cat /tmp/ZappingVLC.txt\` && echo "DISPLAY=$DISPLAY $PLAYER dvb-t:// :dvb-frequency=$FRQ :dvb-bandwidth=$BNDW :program=$PRG &" && echo "pgrep -n vlc >/tmp/ZappingVLC.txt" ) | at $begin

## Aufruf von VLC mit dem Sender; die letzte von Zapping.sh gestarteten Instanzen wird beendet.
else
##   test ! -e /tmp/ZappingVLC.txt && killall vlc
garbage | at $begin-20 minutes
VLCPID=`cat /tmp/ZappingVLC.txt` 
kill $VLCPID
$PLAYER dvb-t:// :dvb-frequency=$FRQ :dvb-bandwidth=$BNDW :program=$PRG &
echo `pgrep -n vlc` >/tmp/ZappingVLC.txt

fi
exit 1

Anhang herunterladen

Diese Revision wurde am 5. Februar 2020 18:31 von ubuntuusers erstellt.