Infosatepg.sh

Aus VDR Wiki
(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
K
Zeile 1: Zeile 1:
#!/bin/sh
+
<pre>
#
+
#
# infosatepg.sh - v.0.6
+
# Required: ps, svdrpsend.pl, infosatepg, tvm2vdr.pl (optional)
#
+
#
# add this lines to your [[commands.conf]]:
+
# add this lines to your commands.conf:
# folgende zeilen in die [[commands.conf]] eintragen:
+
# folgende zeilen in die commands.conf eintragen:
#
+
#
# Run infosatepg              : echo "/usr/local/bin/infosatepg.sh" | at now
+
# Run infosatepg              : echo "/usr/local/bin/infosatepg.sh" | at now
# Run infosatepg + tvmovie2vdr : echo "/usr/local/bin/infosatepg.sh -tvmovie2vdr" | at now
+
# Run infosatepg + tvmovie2vdr : echo "/usr/local/bin/infosatepg.sh -tvmovie2vdr" | at now
#
+
#
# Edit the config.pl:
+
# Edit the config.pl:
#
+
#
# - our $infosaturl="/video/received_data";
+
# - our $infosaturl="/video/received_data";
# + our $infosaturl="/tmp/received_data";
+
# + our $infosaturl="/usr/local/cache/infosatepg";
+
 
# CONFIG START
+
# CONFIG START
  INFOSAT_OPT="-v"                                         # options
+
  INFOSAT_OPT="-v"                               # options
  INFOSAT_OUT="/tmp/received_data"                        # store infosatepg in
+
  CHANNEL="VIVA"                                 # which channel, e.g: <NUM> or <NAME>
  CHANNEL="VIVA"                                           # which channel, e.g: <NUM> or <NAME>
+
  SHOWSTATUS="1"                                 # show status (1=true/0=false)
  TVMOVIE2VDRDIR="$SOURCEDIR/tvmovie2vdr"                  # path to tvmovie2vdr
+
  INFOSAT_OUT="/usr/local/cache/infosatepg"      # store infosatepg in
  SHOWSTATUS="1"                                           # show status (1=true/0=false)
+
  INFOSAT_LOGFILE="/var/log/vdr/infosatepg.log"  # logfile
  EPGSEARCHUPDATEFILE="/etc/vdr/plugins/.epgsearchupdate"  # background scan epgsearch-plugin
+
# CONFIG END
# CONFIG END
+
 
+
PATH=/usr/local/bin:$PATH
PATH=$PATH:/usr/local/bin
+
 
+
if [ -n "$(pidof infosatepg)" ] ; then
if [ -n "$(pidof infosatepg)" ] ; then
+
    svdrpsend.pl MESG "infosatepg is already running..."
    svdrpsend.pl MESG "infosatepg is already running..."
+
else
else
+
    if [ "$(svdrpsend.pl CHAN $CHANNEL | grep -c '^250.*')" -eq 0 ] ; then
    svdrpsend.pl CHAN $CHANNEL | grep -e '^250.*'
+
svdrpsend.pl MESG "switch to $CHANNEL failed..."
    if [ $? -ne 0 ] ; then
+
    else
        sleep 2s
+
mkdir -p $INFOSAT_OUT
        svdrpsend.pl MESG "switch to $CHANNEL failed..."
+
infosatepg $INFOSAT_OPT -o $INFOSAT_OUT > $INFOSAT_LOGFILE &
    else
+
PID=$!
        mkdir -p $INFOSAT_OUT
+
if [ "$SHOWSTATUS" -eq 1 ] ; then
        infosatepg $INFOSAT_OPT -o $INFOSAT_OUT > $INFOSAT_OUT/status &
+
    sh -c "until ! ps -p $PID; do sleep 30s; svdrpsend.pl MESG \"\$(grep -s [0-9]% $INFOSAT_LOGFILE | tail -n 1)\"; done" &
        PID=$!
+
fi
        until ! ps -p $PID >/dev/null ; do
+
wait $PID; kill $!
            if [ $SHOWSTATUS -eq 1 ] ; then
+
svdrpsend.pl MESG "$(tail -n 1 $INFOSAT_LOGFILE)..."
                STATUS=$(grep -s [0-9]% $INFOSAT_OUT/status | tail -n 1)
+
sleep 1s
                eval ${STATUS:+svdrpsend.pl MESG "$STATUS"}
+
svdrpsend.pl HITK 0
            fi
+
if [ -n "$1" -a -n "$(which tvmovie2vdr)" ] ; then
            sleep 30s
+
    tvmovie2vdr -start
        done
+
fi
        if grep -qs complete $INFOSAT_OUT/status ; then
+
    fi
            svdrpsend.pl MESG "infosatepg done..."
+
fi \
            sleep 2s
+
>/dev/null 2>&1
            svdrpsend.pl HITK 0
+
</pre>
        fi
+
        if [ -n "$1" -a -d $TVMOVIE2VDRDIR ] ; then
+
            cd $TVMOVIE2VDRDIR
+
            ./tvm2vdr.pl >/var/log/tvmovie2vdr.log
+
        fi
+
        touch $EPGSEARCHUPDATEFILE
+
    fi
+
fi
+
  
 
[[Kategorie:Scripts]]
 
[[Kategorie:Scripts]]

Version vom 30. März 2005, 11:26 Uhr

#
# Required: ps, svdrpsend.pl, infosatepg, tvm2vdr.pl (optional)
#
# add this lines to your commands.conf:
# folgende zeilen in die commands.conf eintragen:
#
# Run infosatepg               : echo "/usr/local/bin/infosatepg.sh" | at now
# Run infosatepg + tvmovie2vdr : echo "/usr/local/bin/infosatepg.sh -tvmovie2vdr" | at now
#
# Edit the config.pl:
#
# - our $infosaturl="/video/received_data";
# + our $infosaturl="/usr/local/cache/infosatepg";

# CONFIG START
  INFOSAT_OPT="-v"                               # options
  CHANNEL="VIVA"                                 # which channel, e.g: <NUM> or <NAME>
  SHOWSTATUS="1"                                 # show status (1=true/0=false)
  INFOSAT_OUT="/usr/local/cache/infosatepg"      # store infosatepg in
  INFOSAT_LOGFILE="/var/log/vdr/infosatepg.log"  # logfile
# CONFIG END

PATH=/usr/local/bin:$PATH

if [ -n "$(pidof infosatepg)" ] ; then
    svdrpsend.pl MESG "infosatepg is already running..."
else
    if [ "$(svdrpsend.pl CHAN $CHANNEL | grep -c '^250.*')" -eq 0 ] ; then
	svdrpsend.pl MESG "switch to $CHANNEL failed..."
    else
	mkdir -p $INFOSAT_OUT
	infosatepg $INFOSAT_OPT -o $INFOSAT_OUT > $INFOSAT_LOGFILE &
	PID=$!
	if [ "$SHOWSTATUS" -eq 1 ] ; then
	    sh -c "until ! ps -p $PID; do sleep 30s; svdrpsend.pl MESG \"\$(grep -s [0-9]% $INFOSAT_LOGFILE | tail -n 1)\"; done" &
	fi
	wait $PID; kill $!
	svdrpsend.pl MESG "$(tail -n 1 $INFOSAT_LOGFILE)..."
	sleep 1s
	svdrpsend.pl HITK 0
	if [ -n "$1" -a -n "$(which tvmovie2vdr)" ] ; then
	    tvmovie2vdr -start
	fi
    fi
fi \
>/dev/null 2>&1