Better error handling if dvd not found

This commit is contained in:
Julian Mutter 2022-06-04 14:50:01 +00:00
parent 84c522ffb5
commit c547cf000d

View File

@ -31,14 +31,21 @@ if($ARGV[0] eq "help" || $ARGV[0] eq "--help"){
} }
my $dest = "/home/julian/Videos/dvds/"; 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) { if($? != 0){
print "Destination folder already exists!"; print "Failed reading dvd ($source). Could not get title\n";
exit 2; 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"); my $exitcode = system("dvdbackup -i $source -o $dest -M -n $title");
# $exitcode >>= 8; # $exitcode >>= 8;