Infosatepg.sh

Aus VDR Wiki
(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
Zeile 9: Zeile 9:
 
# 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 "/path_to_this_script/infosatepg.sh" | at now
# Run infosatepg + tvmovie2vdr : echo "/usr/local/bin/infosatepg.sh -tvmovie2vdr" | at now
+
# Run infosatepg + tvmovie2vdr : echo "/path_to_this_script/infosatepg.sh -tvmovie2vdr" | at now
 +
# View logfile                : /path_to_this_script/infosatepg.sh -log
 
#
 
#
 
# Edit the config.pl:
 
# Edit the config.pl:
 
#
 
#
 
# - our $infosaturl="/video/received_data";
 
# - our $infosaturl="/video/received_data";
# + our $infosaturl="/usr/local/cache/infosatepg";
+
# + our $infosaturl="$INSTALLPREFIX/cache/infosatepg";
  
 
# CONFIG START
 
# CONFIG START
   INFOSAT_OPT="-v"                               # options
+
   INFOSAT_OPT="-v"                           # options
   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)
+
   SHOWSTATUS="1"                             # show status (1=true/0=false)
   INFOSAT_OUT="/usr/local/cache/infosatepg"     # store infosatepg in
+
   INFOSAT_OUT="/usr/local/cache/infosatepg" # store infosatepg in
   INFOSAT_LOGFILE="/var/log/vdr/infosatepg.log"  # logfile
+
   INFOSAT_LOG="/var/log/vdr/infosatepg.log"  # logfile
 
# CONFIG END
 
# CONFIG END
  
PATH=/usr/local/bin:$PATH
+
PATH=/usr/local/bin:$PATH:$PREFIX/bin
  
if [ -n "$(pidof infosatepg)" ] ; then
+
case $1 in
    svdrpsend.pl MESG "infosatepg is already running..."
+
    -log)
else
+
if [ -s $INFOSAT_LOG ] ; then
    if [ "$(svdrpsend.pl CHAN $CHANNEL | grep -c '^250.*')" -eq 0 ] ; then
+
    tail -n 10 $INFOSAT_LOG | tr -d '#_'
svdrpsend.pl MESG "switch to $CHANNEL failed..."
+
else
    else
+
    echo "$INFOSAT_LOG not exist or empty..."
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
 
fi
wait $PID; kill $!
+
;;
svdrpsend.pl MESG "$(tail -n 1 $INFOSAT_LOGFILE)..."
+
    *)
sleep 1s
+
if [ -n "$(pidof infosatepg)" ] ; then
svdrpsend.pl HITK 0
+
    svdrpsend.pl MESG "infosatepg is already running..."
if [ -n "$1" ] ; then
+
else
            cd $SOURCEDIR/tvmovie2vdr
+
    if [ "$(svdrpsend.pl CHAN $CHANNEL | grep -c '^250.*')" -eq 0 ] ; then
            ./tvm2vdr.pl
+
svdrpsend.pl MESG "switch to $CHANNEL failed..."
fi
+
    else
    fi
+
mkdir -p $INFOSAT_OUT
fi \
+
infosatepg $INFOSAT_OPT -o $INFOSAT_OUT > $INFOSAT_LOG &
>/dev/null 2>&1
+
PID=$!
 +
if [ "$SHOWSTATUS" -eq 1 ] ; then
 +
    sh -c "until ! ps -p $PID; do sleep 30s; svdrpsend.pl MESG \"\$(grep -s [0-9]% $INFOSAT_LOG | tail -n 1)\"; done" &
 +
fi
 +
wait $PID; kill $!
 +
svdrpsend.pl MESG "$(tail -n 1 $INFOSAT_LOG)..."
 +
sleep 1s
 +
svdrpsend.pl HITK 0
 +
if [ -n "$1" -a -n "$(which tvmovie2vdr)" ] ; then
 +
    tvmovie2vdr -start
 +
fi
 +
    fi
 +
fi \
 +
>/dev/null 2>&1
 +
;;
 +
esac
 
</pre>
 
</pre>
  
 
[[Kategorie:Scripts]]
 
[[Kategorie:Scripts]]

Version vom 16. April 2005, 09:14 Uhr

#!/bin/sh
#
# infosatepg.sh
#
# 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 "/path_to_this_script/infosatepg.sh" | at now
# Run infosatepg + tvmovie2vdr : echo "/path_to_this_script/infosatepg.sh -tvmovie2vdr" | at now
# View logfile                 : /path_to_this_script/infosatepg.sh -log
#
# Edit the config.pl:
#
# - our $infosaturl="/video/received_data";
# + our $infosaturl="$INSTALLPREFIX/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_LOG="/var/log/vdr/infosatepg.log"  # logfile
# CONFIG END

PATH=/usr/local/bin:$PATH:$PREFIX/bin

case $1 in
    -log)
	if [ -s $INFOSAT_LOG ] ; then
	    tail -n 10 $INFOSAT_LOG | tr -d '#_'
	else
	    echo "$INFOSAT_LOG not exist or empty..."
	fi
	;;
    *)
	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_LOG &
		PID=$!
		if [ "$SHOWSTATUS" -eq 1 ] ; then
		    sh -c "until ! ps -p $PID; do sleep 30s; svdrpsend.pl MESG \"\$(grep -s [0-9]% $INFOSAT_LOG | tail -n 1)\"; done" &
		fi
		wait $PID; kill $!
		svdrpsend.pl MESG "$(tail -n 1 $INFOSAT_LOG)..."
		sleep 1s
		svdrpsend.pl HITK 0
		if [ -n "$1" -a -n "$(which tvmovie2vdr)" ] ; then
		    tvmovie2vdr -start
		fi
	    fi
	fi \
	>/dev/null 2>&1
	;;
esac