Savvy.sh

Aus VDR Wiki
(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
Zeile 2: Zeile 2:
 
#!/bin/sh
 
#!/bin/sh
 
#
 
#
# sample script for savvy
+
# savvy.sh - v.0.1
 
#
 
#
# need: mplayer, savvy, lame, wget, at, normalize (optional)
+
# add this lines to your reccmds.conf:
 +
# folgende zeilen in die reccmds.conf eintragen:
 +
#
 +
# Start savvy : /usr/local/bin/savvy.sh -start
 +
# Stop savvy? : /usr/local/bin/savvy.sh -kill
  
 
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:$SOURCEDIR/savvy
 
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:$SOURCEDIR/savvy
  
SAVVYOPT="-nn"
+
# CONFIG START
 +
  SAVVYOPT="-nn" # Don't run "normalize"
 +
# CONFIG END
  
msg() {
+
case "${1}" in
    echo -e "-----------\n${@}\n-----------"
+
      -start)
}
+
msg() {
 +
    echo -e "-----------\n${@}\n-----------"
 +
}
  
testproc() {
+
testproc() {
    test "$(ps axc|awk "{if (\$5==\"$1\") print \$1}")"
+
    test "$(ps axc|awk "{if (\$5==\"$1\") print \$1}")"
}
+
}
  
for i in lame wget at savvy mplayer ; do
+
for i in lame wget at savvy mplayer ; do
    which "${i}" >/dev/null 2>&1 || {
+
    which "${i}" >/dev/null 2>&1 || {
msg "ERROR: ${i} not found..."
+
msg "ERROR: ${i} not found..."
exit 1
+
exit 1
    }
+
    }
done
+
done
  
testproc savvy && {
+
testproc savvy && {
    msg "MESG: savvy is always running..."
+
    msg "MESG: savvy is always running..."
    exit 1
+
    exit 1
}
+
}
  
ping -c 2 www.viva.de >/dev/null 2>&1 || {
+
ping -c 2 www.viva.de >/dev/null 2>&1 || {
    msg "ERROR: check your www connection..."
+
    msg "ERROR: check your www connection..."
    exit 1
+
    exit 1
}
+
}
  
cd $SOURCEDIR/savvy
+
cd "${MYPATH}/savvy"
  
rm -f *.html
+
rm -f *.html
  
wget -c http://www.vivaplus.tv/gettheclip.html || {
+
wget -c http://www.vivaplus.tv/gettheclip.html || {
    msg "ERROR: check your www connection..."
+
    msg "ERROR: check your www connection..."
    exit 1
+
    exit 1
}
+
}
  
test ! -e gettheclip.html && {
+
test ! -e gettheclip.html && {
    msg "ERROR: gettheclip.html not exist, check the www connection..."
+
    msg "ERROR: gettheclip.html not exist, check the www connection..."
    exit 1
+
    exit 1
}
+
}
  
at now <<EOM
+
at now <<EOF
./savvy ${SAVVYOPT} ${1}/
+
cd $SOURCEDIR/savvy
EOM
+
./savvy ${SAVVYOPT} ${2}/
 +
EOF
  
sleep 1s && testproc savvy && {
+
sleep 1s && testproc savvy && {
    msg "MESG: savvy startet..."
+
    msg "MESG: savvy startet..."
}
+
}
 +
;;
 +
      -kill)
 +
killall savvy
 +
;;
 +
esac
 
</pre>
 
</pre>
  
 
[[Kategorie:Scripts]]
 
[[Kategorie:Scripts]]

Version vom 22. November 2004, 16:00 Uhr

#!/bin/sh
#
# savvy.sh - v.0.1
#
# add this lines to your reccmds.conf:
# folgende zeilen in die reccmds.conf eintragen:
#
# Start savvy : /usr/local/bin/savvy.sh -start
# Stop savvy? : /usr/local/bin/savvy.sh -kill

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:$SOURCEDIR/savvy

# CONFIG START
  SAVVYOPT="-nn" # Don't run "normalize"
# CONFIG END

case "${1}" in
      -start)
	msg() {
	    echo -e "-----------\n${@}\n-----------"
	}

	testproc() {
	    test "$(ps axc|awk "{if (\$5==\"$1\") print \$1}")"
	}

	for i in lame wget at savvy mplayer ; do
	    which "${i}" >/dev/null 2>&1 || {
		msg "ERROR: ${i} not found..."
		exit 1
	    }
	done

	testproc savvy && {
	    msg "MESG: savvy is always running..."
	    exit 1
	}

	ping -c 2 www.viva.de >/dev/null 2>&1 || {
	    msg "ERROR: check your www connection..."
	    exit 1
	}

	cd "${MYPATH}/savvy"

	rm -f *.html

	wget -c http://www.vivaplus.tv/gettheclip.html || {
	    msg "ERROR: check your www connection..."
	    exit 1
	}

	test ! -e gettheclip.html && {
	    msg "ERROR: gettheclip.html not exist, check the www connection..."
	    exit 1
	}

at now <<EOF
cd $SOURCEDIR/savvy
./savvy ${SAVVYOPT} ${2}/
EOF

	sleep 1s && testproc savvy && {
	    msg "MESG: savvy startet..."
	}
	;;
      -kill)
	killall savvy
	;;
esac