Dvdselect writedvd.sh
Aus VDR Wiki
(Unterschied zwischen Versionen)
Wirbel (Diskussion | Beiträge) |
|||
(12 dazwischenliegende Versionen von 11 Benutzern werden nicht angezeigt) | |||
Zeile 1: | Zeile 1: | ||
− | + | Skripte vom [[dvdselect-plugin]]. | |
− | + | ||
− | + | {{Box Datei | [[Struktur|$PATH]]/dvdselect_writedvd.sh | | |
− | + | <pre> | |
− | + | #!/bin/sh | |
− | + | # | |
− | + | # dvdselect_writedvd.sh | |
− | + | # | |
− | + | # 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 | |
+ | </pre> | ||
+ | }} | ||
− | + | {{Box Datei | [[Struktur|$PATH]]/dvdselect_writedvd.sh | | |
+ | <pre> | ||
+ | #!/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 | ||
+ | </pre> | ||
+ | }} | ||
− | + | {{Box Datei | [[Struktur|$PATH]]/dvdselect_writedvd.sh | | |
− | + | <pre> | |
− | + | #!/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 | |
− | "| at now | + | /tmp/dvdselect-burn-temp.sh & |
+ | </pre> | ||
+ | }} | ||
+ | |||
+ | {{Box Datei | [[Struktur|$PATH]]/dvdselect_writedvd.sh | | ||
+ | <pre> | ||
+ | #!/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 | ||
+ | </pre> | ||
+ | }} | ||
+ | |||
+ | {{Box Datei | [[Struktur|$PATH]]/dvdselect_writedvd.sh | | ||
+ | <pre> | ||
+ | #!/bin/sh | ||
+ | # | ||
+ | # 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 | ||
+ | # | ||
+ | # 10/10/2006 - st_barszus.at.gmx.de - thanks to wilderigel, Bert etc at vdrportal :-) | ||
+ | # * made sure that we don't give more then 32 as Volume name for dvd direcory | ||
+ | # | ||
+ | # Extended write/burn script for dvdselect and dvdswitch | ||
+ | # | ||
+ | ###################################### | ||
+ | |||
+ | SVDRPSEND=/usr/lib/vdr/svdrpsend.pl | ||
+ | DVDWRITER=/dev/hdd | ||
+ | |||
+ | ###################################### | ||
+ | |||
+ | cleanup () { | ||
+ | $SVDRPSEND mesg "$1" | ||
+ | logger -t $0 "$1" | ||
+ | logger -t $0 < $CHECKFILE | ||
+ | rm -f $CHECKFILE | ||
+ | eject $DVDWRITER | ||
+ | exit 0 | ||
+ | } | ||
+ | |||
+ | isminusrw () { | ||
+ | MEDIA="`grep "^ Mounted Media" $CHECKFILE | cut -d" " -f13`" | ||
+ | [ -z $MEDIA ] && cleanup | ||
+ | [ "$MEDIA" = "DVD-RW" ] && return 0 || return 1 | ||
+ | } | ||
+ | |||
+ | isplusrw () { | ||
+ | MEDIA="`grep "^ Mounted Media" $CHECKFILE | cut -d" " -f13`" | ||
+ | [ -z $MEDIA ] && cleanup | ||
+ | [ "$MEDIA" = "DVD+RW" ] && return 0 || return 1 | ||
+ | } | ||
+ | |||
+ | |||
+ | dvd_isempty () { | ||
+ | USED="`grep "^ Disc status" $CHECKFILE | cut -d":" -f2 | sed -e ' s/ //g'`" | ||
+ | |||
+ | case $USED in | ||
+ | blank|appendable) | ||
+ | return 0 ;; | ||
+ | *) | ||
+ | return 1 ;; | ||
+ | esac | ||
+ | } | ||
+ | |||
+ | |||
+ | have_media () { | ||
+ | [ -z "`grep \"^:-( no media\" $CHECKFILE`" ] && return 0 || return 1 | ||
+ | } | ||
+ | |||
+ | ### start skript | ||
+ | # close if the drive is open | ||
+ | eject -t $DVDWRITER | ||
+ | |||
+ | # what is in the drive ? | ||
+ | CHECKFILE=`mktemp` | ||
+ | dvd+rw-mediainfo $DVDWRITER &> $CHECKFILE | ||
+ | |||
+ | if ! have_media ; then | ||
+ | cleanup "No Media found." | ||
+ | fi | ||
+ | |||
+ | if ! dvd_isempty ; then | ||
+ | if isminusrw ; then | ||
+ | # only DVD-RW need to be formated again, DVD+RW can get just overwritten | ||
+ | echo " ( dvd+rw-format $DVDWRITER -force ) " | at now | ||
+ | else | ||
+ | if ! isplusrw ; then | ||
+ | cleanup "Media full. Insert empty media." | ||
+ | fi | ||
+ | fi | ||
+ | fi | ||
+ | |||
+ | if [ -d "$1" ]; then | ||
+ | NAME="`basename \"$1\"`" | ||
+ | |||
+ | # write dvd structure | ||
+ | echo "while [ \"x`pgrep -o dvd.rw`\" != \"x\" ] ;do sleep 2; done && growisofs -use-the-force-luke=tty -dvd-compat -Z $DVDWRITER -dvd-video -V \" | ||
+ | ${NAME:0:31}\" \"$1\" && eject " | at now | ||
+ | else | ||
+ | if [ -f "$1" ]; then | ||
+ | # write dvd image | ||
+ | echo "while [ \"x`pgrep -o dvd.rw`\" != \"x\"] ;do sleep 2; done && growisofs -dvd-compat -use-the-force-luke=tty -Z $DVDWRITER=\"$1\" && | ||
+ | eject " | at now | ||
+ | else | ||
+ | cleanup "File: \"$1\" not found." | ||
+ | fi | ||
+ | fi | ||
+ | |||
+ | # cleanup after all was successfull | ||
+ | $SVDRPSEND mesg "Start writing to media." | ||
+ | rm -f $CHECKFILE | ||
+ | </pre> | ||
+ | }} | ||
− | [[Kategorie: | + | [[Kategorie:Skripte]] |
+ | {{i18n|Dvdselect writedvd.sh}} |
Aktuelle Version vom 2. Dezember 2013, 16:48 Uhr
Skripte vom dvdselect-plugin.
$PATH/dvdselect_writedvd.sh
#!/bin/sh # # dvdselect_writedvd.sh # # 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
$PATH/dvdselect_writedvd.sh
#!/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
$PATH/dvdselect_writedvd.sh
#!/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 &
$PATH/dvdselect_writedvd.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
$PATH/dvdselect_writedvd.sh
#!/bin/sh # # 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 # # 10/10/2006 - st_barszus.at.gmx.de - thanks to wilderigel, Bert etc at vdrportal :-) # * made sure that we don't give more then 32 as Volume name for dvd direcory # # Extended write/burn script for dvdselect and dvdswitch # ###################################### SVDRPSEND=/usr/lib/vdr/svdrpsend.pl DVDWRITER=/dev/hdd ###################################### cleanup () { $SVDRPSEND mesg "$1" logger -t $0 "$1" logger -t $0 < $CHECKFILE rm -f $CHECKFILE eject $DVDWRITER exit 0 } isminusrw () { MEDIA="`grep "^ Mounted Media" $CHECKFILE | cut -d" " -f13`" [ -z $MEDIA ] && cleanup [ "$MEDIA" = "DVD-RW" ] && return 0 || return 1 } isplusrw () { MEDIA="`grep "^ Mounted Media" $CHECKFILE | cut -d" " -f13`" [ -z $MEDIA ] && cleanup [ "$MEDIA" = "DVD+RW" ] && return 0 || return 1 } dvd_isempty () { USED="`grep "^ Disc status" $CHECKFILE | cut -d":" -f2 | sed -e ' s/ //g'`" case $USED in blank|appendable) return 0 ;; *) return 1 ;; esac } have_media () { [ -z "`grep \"^:-( no media\" $CHECKFILE`" ] && return 0 || return 1 } ### start skript # close if the drive is open eject -t $DVDWRITER # what is in the drive ? CHECKFILE=`mktemp` dvd+rw-mediainfo $DVDWRITER &> $CHECKFILE if ! have_media ; then cleanup "No Media found." fi if ! dvd_isempty ; then if isminusrw ; then # only DVD-RW need to be formated again, DVD+RW can get just overwritten echo " ( dvd+rw-format $DVDWRITER -force ) " | at now else if ! isplusrw ; then cleanup "Media full. Insert empty media." fi fi fi if [ -d "$1" ]; then NAME="`basename \"$1\"`" # write dvd structure echo "while [ \"x`pgrep -o dvd.rw`\" != \"x\" ] ;do sleep 2; done && growisofs -use-the-force-luke=tty -dvd-compat -Z $DVDWRITER -dvd-video -V \" ${NAME:0:31}\" \"$1\" && eject " | at now else if [ -f "$1" ]; then # write dvd image echo "while [ \"x`pgrep -o dvd.rw`\" != \"x\"] ;do sleep 2; done && growisofs -dvd-compat -use-the-force-luke=tty -Z $DVDWRITER=\"$1\" && eject " | at now else cleanup "File: \"$1\" not found." fi fi # cleanup after all was successfull $SVDRPSEND mesg "Start writing to media." rm -f $CHECKFILE