Dvdselect writedvd.sh

Aus VDR Wiki
Wechseln zu: Navigation, Suche
#!/bin/sh
#
# dvdselect_writedvd.sh - v.0.1
#
# source: dvdselect-plugin
#
# This script will by called by the vdr-plugin dvdselect to copy a DVD to
# write a dvd iso image.
#
# It gets the following parameter:
#
# $1 = filename of the iso file

echo "dvdrecord -eject -v dev=0,0,0 speed=4 -dao $1 > /var/log/vdr/writedvd.log 2>&1" | at now
#!/bin/sh
#
# source: http://www.hoochvdr.info
#
# $1 = filename of the iso file

DVD_RECORDCMD="growisofs"
DVDPLUS_RECORD_OPTS="-dvd-compat -Z"
DVDWRITER=/dev/hdc

echo " \
unset SUDO_COMMAND ; \
svdrpsend.pl -d localhost "MESG DVD burn initiated" 2>/dev/null 1>/dev/null ; \
svdrpsend.pl -d localhost "QUIT" 2>/dev/null 1>/dev/null ; \
exec $DVD_RECORDCMD $DVDPLUS_RECORD_OPTS $DVDWRITER=$1 ; \
svdrpsend.pl -d localhost "MESG DVD burn completed" 2>/dev/null 1>/dev/null ; \
svdrpsend.pl -d localhost "QUIT" 2>/dev/null 1>/dev/null ; \
"| at now
#!/bin/sh
#
# source: http://www.hoochvdr.info
#
# Angepasst für LinVDR 0.7, da es kein at-Kommando gibt
# Modified for LinVDR 0.7, because there is no at-command available
#
# $1 = filename of the iso file

DVD_RECORDCMD="growisofs"
DVDPLUS_RECORD_OPTS="-dvd-compat -Z"
DVDWRITER=/dev/hdc

echo " \
svdrpsend.pl -d localhost "MESG DVD brennen gestartet" 2>/dev/null 1>/dev/null ; \
$DVD_RECORDCMD $DVDPLUS_RECORD_OPTS $DVDWRITER=\"$1\" ; \
svdrpsend.pl -d localhost "MESG DVD fertig" 2>/dev/null 1>/dev/null ; \
" > /tmp/dvdselect-burn-temp.sh

chmod 700 /tmp/dvdselect-burn-temp.sh
/tmp/dvdselect-burn-temp.sh &
#!/bin/sh
#
# This script will be called by the vdr-plugin dvdselect
# to write a dvd iso image.
#
# It gets the following parameter:
#
# $1 = filename of the iso file
#
# Erweiterung: 2005-01-18 Claus.Thiemann (at) gmx.de
# Nutzung eines installierten vdrconvert zum Brennen
# Die Variablen muessen an die verwendete Distribution angepasst werden

BASENAME="$(basename $0)"
CONF=/etc/vdr/vdrconvert/vdrconvert.dvd.conf
ISO="$1"
JOB=/var/spool/vdrconvert/burn
SVDRP=/usr/lib/vdr/svdrpsend.pl

function f_check_file() {
# Gibts die Datei?
[ -s $1 ] && return 0
# Meldung ausgeben auf TV und SysLog
MSG="$1 nicht gefunden"
# und zwar im Hintergrund wegen Broken Pipe Problem
$SVDRP MESG $MSG > /dev/null &
echo $MSG ; sleep 3
return 1
}

function f_check_job() {
# Gibts die Datei noch nicht oder ist sie leer?
[ -s $1 ] || return 0
MSG="$1 ist nicht leer"
$SVDRP MESG $MSG > /dev/null &
echo $MSG ; sleep 3
return 1
}

function f_init_burn() {
# "Sourcen" der Konfiguration
. $CONF
[ -z "$CDSIZE" ] && CDSIZE=700
SIZE=$(ls -al $ISO | awk '{print $5}')
SIZE=$[$SIZE/1048576]
[ $SIZE -le $CDSIZE ] && TYP="MINIDVD" || TYP="DVD"
[ $MINIDVD != "yes" ] && TYP="DVD"
MSG="$(basename $ISO) ($SIZE MB) wird als $TYP gebrannt..."
$SVDRP MESG $MSG > /dev/null &
echo $MSG ; sleep 3
echo "$ISO:$TYP:" > $JOB
return 0
}

f_main() {
f_check_file $SVDRP || return
f_check_file $CONF || return
f_check_file $ISO || return
f_check_job $JOB || return
f_init_burn
}

# Aufruf der Haupt-Funktion mit oder ohne Syslog
#f_main
f_main | logger -i -t $BASENAME

# EOF