diff options
-rwxr-xr-x | abs/core/LinHES-system/PKGBUILD | 4 | ||||
-rwxr-xr-x | abs/core/LinHES-system/ripD_eject.sh | 104 |
2 files changed, 60 insertions, 48 deletions
diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD index 3de7853..fbf5ae1 100755 --- a/abs/core/LinHES-system/PKGBUILD +++ b/abs/core/LinHES-system/PKGBUILD @@ -1,6 +1,6 @@ pkgname=LinHES-system pkgver=8.4 -pkgrel=24 +pkgrel=25 arch=('i686' 'x86_64') install=system.install pkgdesc="Everything that makes LinHES an automated system" @@ -134,7 +134,7 @@ md5sums=('c6e6b83a1f4c35ef4501e277657ab2ac' 'ff689f2e9572a78d88384b2e5774f579' '28f29578e5b3ba84fdf2aa57cf475bcf' '4a1fda884dcd7d65fb2690fbdbd92a83' - '2b7fe3b57592823a4c7e3ec132dcb7f4' + '29f451783db3220b612e00c29e3ded73' 'de3028ed75b53bd2f85ffbfdf64c44c2' '95c092f67036a361ef7a57436f44332e' '410795ef9039e4c6c0484e706ecfd567' diff --git a/abs/core/LinHES-system/ripD_eject.sh b/abs/core/LinHES-system/ripD_eject.sh index 715d0dd..baef7a1 100755 --- a/abs/core/LinHES-system/ripD_eject.sh +++ b/abs/core/LinHES-system/ripD_eject.sh @@ -9,7 +9,7 @@ Bsnd='/usr/share/sounds/init.wav' # Begin sound file Esnd='/usr/share/sounds/complete.wav' # End sound file DATE=$(date +%Y%m%d_%H%M) # current date/time LOG='/var/log/mythtv/ripD.log' # name of Log file. -TRACK=$(lsdvd | grep -i longest | awk '{print $3}') #Finds longest track +#TRACK=$(lsdvd | grep -i longest | awk '{print $3}') #Finds longest track FILE=$TITLE #----------------------------------------------------------------------- [ -r /etc/rip.cfg ] && . /etc/rip.cfg @@ -18,30 +18,51 @@ LOCK=/tmp/.ripLock.$$ [ "$DISPLAY" == "" ] && export DISPLAY=:0 ######################################################################## function osd { # $1=text, $2=delay + msg_client.py --clear ripD msg_client.py --kill - msg_client.py --msg "$1" --timeout $2 + msg_client.py --msg "$1" --timeout $2 --tag ripD } >& /dev/null + function osd_loop() { FN=$1 ; shift TXT="to $dir/$FILE" N=0 while [ -f "$LOCK" ]; do - osd "Backing up '$TITLE' $TXT" 70 - N=$(($N+1)) -# [ -d "$FN" ] && SIZE=$(du -sh $FN | awk '{print $1}') -# TXT="$SIZE of $MAX @ $N min. elapsed" - TXT="($N min. elapsed)" - sleep 60 + osd "Backing up '$TITLE' $TXT" 70 + N=$(($N+1)) + TXT="($N min. elapsed)" + sleep 60 done } ######################################################################## osd "Detecting DVD..." 60 & -echo "`date` detected DVD" >> $LOG -rm -f /tmp/.ripLock.* +# first make sure DMA is on: +sudo hdparm -d1 -u1 $DEV >& /dev/null +dvdFound=false +for c in {1..10}; do + dvdBACKlog=$(dvdbackup -i /dev/sr0 -I) + if [[ $dvdBACKlog == *"information"* ]]; then + echo "`date` detected DVD" >> $LOG + rm -f /tmp/.ripLock.* + # attempt to get the DVD information: + TITLE=$(dvdbackup -i /dev/sr0 -I | grep information | awk '{ s = ""; for (i = 8; i <= NF; i++) s = s $i " "; print s }' | tr -d '"' | sed 's/ /_/g' | sed 's/_$//g') + dvdFound=true + osd "Found DVD '$TITLE'" 10 & + sleep 1 + break + fi + sleep 3 +done +if ! $dvdFound ; then + echo "no DVD" >> $LOG + osd "DVD not found" 10 & + eject ; eject + exit 0 +fi #======================================================================= for dir in $Ddir ; do if [ -d $dir -a -w $dir ]; then - break + break fi done #----------------------------------------------------------------------- @@ -58,61 +79,52 @@ if [ ! -w "$dir" ]; then exit 0 fi #----------------------------------------------------------------------- -mount $DEV >& /dev/null -dev=$(readlink $DEV) -df=$(df -h /dev/$dev | grep /dev/$dev) -MAX=$(echo $df | while read d v r ; do echo $v ; done) -echo " backup $MAX to $dir" >> $LOG +#mount $DEV >& /dev/null +#dev=$(readlink $DEV) +#df=$(df -h /dev/$dev | grep /dev/$dev) +#MAX=$(echo $df | while read d v r ; do echo $v ; done) +#echo " backup $MAX to $dir" >> $LOG #======================================================================= -# first make sure DMA is on: -sudo hdparm -d1 -u1 $DEV >& /dev/null -# attempt to get the DVD information: -TITLE=$(dvdbackup -i /dev/sr0 -I | grep information | awk '{ s = ""; for (i = 8; i <= NF; i++) s = s $i " "; print s }' | tr -d '"' | sed 's/ /_/g' | sed 's/_$//g') if [ "$TITLE" == "DVD_VIDEO" -o "$TITLE" == "" \ - -o "$TITLE" == " " -o "$TITLE" == "[ ].*" ]; then + -o "$TITLE" == " " -o "$TITLE" == "[ ].*" ]; then # if not a good title, TITLE="dvdbackup_$DATE" fi echo " $TITLE" >> $LOG -if [ $1 = m ] -then - COMMAND="dvdbackup -M -i $DEV -o $dir -n $TITLE" - elif [ $1 = h ] - then -# COMMAND="mencoder dvd://$TRACK -alang en -oac mp3lame -lameopts br=320:cbr -ovc lavc -lavcopts vcodec=mpeg4:vhq -vf scale -zoom -xy 720 -o $dir/$TITLE.avi" - COMMAND="HandBrakeCLI -i $DEV -o $dir/$TITLE.mp4 --preset "High\ Profile" --main-feature" - FILE=$TITLE.mp4 - elif [ $1 = n ] - then -# COMMAND="mencoder dvd://$TRACK -alang en -oac mp3lame -lameopts br=160:cbr -ovc lavc -lavcopts vcodec=mpeg4:vhq -vf scale -zoom -xy 512 -o $dir/$TITLE.avi" - COMMAND="HandBrakeCLI -i $DEV -o $dir/$TITLE.mp4 --preset "Normal" --main-feature" - FILE=$TITLE.mp4 - elif [ $1 = l ] - then -# COMMAND="mencoder dvd://$TRACK -alang en -oac mp3lame -lameopts br=96:cbr -ovc lavc -lavcopts vcodec=mpeg4:vhq -vf scale -zoom -xy 320 -o $dir/$TITLE.avi" - COMMAND="HandBrakeCLI -i $DEV -o $dir/$TITLE.mp4 --preset "Classic" --main-feature" - FILE=$TITLE.mp4 - elif [ $1 = i ] - then - COMMAND="dd if=$DEV of=$dir/$TITLE.iso bs=2048" - FILE=$TITLE.iso +if [[ $1 = "m" ]]; then + COMMAND='dvdbackup -M -i $DEV -o $dir -n $TITLE' + FILE=$TITLE +elif [[ $1 = "h" ]]; then + COMMAND='HandBrakeCLI -i $DEV -o $dir/$TITLE.mp4 --preset "HQ 480p30 Surround" --main-feature' + FILE=$TITLE.mp4 +elif [[ $1 = "n" ]]; then + COMMAND='HandBrakeCLI -i $DEV -o $dir/$TITLE.mp4 --preset "Fast 480p30" --main-feature' + FILE=$TITLE.mp4 +elif [[ $1 = "l" ]]; then + COMMAND='HandBrakeCLI -i $DEV -o $dir/$TITLE.mp4 --preset "Very Fast 480p30" --main-feature' + FILE=$TITLE.mp4 +else + COMMAND='dd if=$DEV of=$dir/$TITLE.iso bs=2048' + FILE=$TITLE.iso fi { # for the redir below: # Begin: touch $LOCK osd_loop "$dir/$TITLE" "$TITLE" & - dvdbackup -i $DEV -I sleep 1 ; aplay $Bsnd - $COMMAND + eval $COMMAND # Finish: rm -f $LOCK + sleep 1 osd "Done Backing up '$TITLE' to $dir/$FILE" 5 & - sleep 1 ; aplay $Esnd + sleep 1 + aplay $Esnd # Eject the media: sudo eject ; sudo eject } > $dir/.$TITLE.log 2>&1 echo " `du -sh $dir/$FILE`" >> $LOG echo " `date` finished DVD" >> $LOG +echo "" >> $LOG exit 0 ######################################################################## # End |