diff --git a/rip_dvd.pl b/rip_dvd.pl index f7dc91c..c7631bf 100755 --- a/rip_dvd.pl +++ b/rip_dvd.pl @@ -31,14 +31,21 @@ if($ARGV[0] eq "help" || $ARGV[0] eq "--help"){ } my $dest = "/home/julian/Videos/dvds/"; -my $title = trim `lsdvd /dev/cdrom | grep "Disc Title" | sed 's/Disc Title: //'`; +my $title = `lsdvd /dev/cdrom | grep "Disc Title"`; -if(-d $dest . $title) { - print "Destination folder already exists!"; - exit 2; +if($? != 0){ + print "Failed reading dvd ($source). Could not get title\n"; + exit(1); } -print "Ripping dvd $title ($source) to $dest"; +$title = trim `echo $title | sed 's/Disc Title: //'`; + +print "Ripping dvd $title ($source) to $dest\n"; + +if(-d $dest . $title) { + print "Destination folder already exists!\n"; + exit 2; +} my $exitcode = system("dvdbackup -i $source -o $dest -M -n $title"); # $exitcode >>= 8;