|
From: <lor...@us...> - 2006-10-27 00:38:25
|
Revision: 248
http://svn.sourceforge.net/mp3roaster/?rev=248&view=rev
Author: lorenzo1
Date: 2006-10-26 17:38:21 -0700 (Thu, 26 Oct 2006)
Log Message:
-----------
Made the burning application that MP3Roaster uses configurable both on the command line and in the config file.
Modified Paths:
--------------
trunk/mp3roaster/mp3roaster.pl
Modified: trunk/mp3roaster/mp3roaster.pl
===================================================================
--- trunk/mp3roaster/mp3roaster.pl 2006-10-26 20:42:43 UTC (rev 247)
+++ trunk/mp3roaster/mp3roaster.pl 2006-10-27 00:38:21 UTC (rev 248)
@@ -50,6 +50,7 @@
\%opthash,
+ 'opt_cdr_app|app|A=s',
'opt_cdr_dev|dev|D=s',
'opt_file_list|list|L=s',
'opt_cdr_speed|speed|s=i',
@@ -86,6 +87,7 @@
$def_description.
Options:
+-A, --app Cdrecord-compatible burning app to use.
-D, --dev CDR device to use.
-s, --speed Burn speed.
-d, --dummy Burn with laser off.
@@ -228,6 +230,7 @@
# This variables are found in the configuration file and
# need to be declared here in order to follow `use strict`
+ my $config_cdr_app;
my $config_cdr_dev;
my $config_cdr_speed;
my $config_cdr_dummy;
@@ -246,6 +249,7 @@
# or MUST be passed to the program as a command line option
%refhash = (
+ "config_cdr_app" => \$config_cdr_app,
"config_cdr_dev" => \$config_cdr_dev,
"config_cdr_speed" => \$config_cdr_speed,
"config_cdr_dummy" => \$config_cdr_dummy,
@@ -395,13 +399,13 @@
# fetch_atip_time
#
# This function fetches the ATIP of the CD/RW Disc.
-# We use the cdrecord application to get this infos.
+# We use a cdrecord-compatible application to get this infos.
#
# We return the ATIP time in seconds.
#
sub fetch_atip_time {
- my ($config_cdr_dev) = @_;
+ my ($config_cdr_app, $config_cdr_dev) = @_;
my $sub = "FETCH_ATIP_TIME";
my $atip_sec;
my $atip_min;
@@ -409,12 +413,12 @@
if (!$config_cdr_dev) {
- my $r_message = "You must specify the CDR/W drive id in the configuration file or with\n the option --drive x.y.z. Execute: % cdrecord \-scanbus for further details.";
+my $r_message = "You must specify the CDR/W drive id in the configuration file or with\n the option --drive x.y.z. Execute: % $config_cdr_app \-scanbus for further details.";
die print_error($sub, $r_message);
}
- # open file and use "cdrecord -atip" to fetch ATIP info
- open(CDINFO,"cdrecord -atip dev=".$config_cdr_dev." 2>&1 |");
+ # open file and use $config_cdr_app." -atip" to fetch ATIP info
+ open(CDINFO,$config_cdr_app." -atip dev=".$config_cdr_dev." 2>&1 |");
while (<CDINFO>) {
@@ -1041,16 +1045,16 @@
# burn
#
# This function burns all wav files to a CD/RW disc
-# using the cdrecord application, if cdrecord returns
+# using a cdrecord-compatible application, if the application returns
# an error code we print out an error message and die,
# else we go back to main without any return value.
#
sub burn {
- my ($config_cdr_dev, $config_cdr_speed, $config_cdr_dummy, $config_cdr_dao, $config_cdr_burnfree, @wav_array) = @_;
+ my ($config_cdr_app, $config_cdr_dev, $config_cdr_speed, $config_cdr_dummy, $config_cdr_dao, $config_cdr_burnfree, @wav_array) = @_;
my $sub = "BURN";
my $burn_wav_list;
- my $cdrecord_options;
+ my $cdr_app_options;
my $cmd;
my $rc;
@@ -1059,34 +1063,34 @@
$burn_wav_list = $burn_wav_list." \"$wav\"";
}
- $cdrecord_options = "dev=$config_cdr_dev speed=$config_cdr_speed gracetime=2 -eject -pad -audio -silent";
+ $cdr_app_options = "dev=$config_cdr_dev speed=$config_cdr_speed gracetime=2 -eject -pad -audio -silent";
if ($config_cdr_dummy) {
- $cdrecord_options = $cdrecord_options." -dummy";
+ $cdr_app_options = $cdr_app_options." -dummy";
}
if ($config_cdr_dao) {
- $cdrecord_options = $cdrecord_options." -dao";
+ $cdr_app_options = $cdr_app_options." -dao";
} else {
- $cdrecord_options = $cdrecord_options." -tao";
+ $cdr_app_options = $cdr_app_options." -tao";
}
if ($config_cdr_burnfree) {
- $cdrecord_options = $cdrecord_options." driveropts=burnfree";
+ $cdr_app_options = $cdr_app_options." driveropts=burnfree";
}
# Let's burn folks -- Finally!
- $cmd = "cdrecord $cdrecord_options $burn_wav_list >/dev/null 2>&1";
+ $cmd = "$config_cdr_app $cdr_app_options $burn_wav_list >/dev/null 2>&1";
$rc = system($cmd);
if ($rc) {
- die print_error($sub, "the burn process was not successful,\n cdrecord error code $rc.");
+ die print_error($sub, "the burn process was not successful,\n $config_cdr_app error code $rc.");
}
}
@@ -1210,7 +1214,8 @@
print " * Options [ ";
%confhash = read_config_file_and_options($config_file_location);
- # print "dev ($confhash{config_cdr_dev}) ";
+ print "burning app ($confhash{config_cdr_app}) ";
+ print "dev ($confhash{config_cdr_dev}) ";
print "$confhash{config_cdr_speed}x ";
print "dummy " if ($confhash{config_cdr_dummy});
@@ -1256,7 +1261,7 @@
#
# 5: check if files fit on CD/RW
#
- compare_file_atip(fetch_atip_time($confhash{config_cdr_dev}), fetch_file_time(@file_array));
+ compare_file_atip(fetch_atip_time($confhash{config_cdr_app}, $confhash{config_cdr_dev}), fetch_file_time(@file_array));
#
# 6: check the temp directory
@@ -1312,7 +1317,7 @@
# printf " * Burning %d files, please wait... ", ($#wav_array+1);
#
print " * Burning files, please wait... ";
- burn($confhash{config_cdr_dev}, $confhash{config_cdr_speed}, $confhash{config_cdr_dummy}, $confhash{config_cdr_dao}, $confhash{config_cdr_burnfree}, @wav_array);
+ burn($confhash{config_cdr_app}, $confhash{config_cdr_dev}, $confhash{config_cdr_speed}, $confhash{config_cdr_dummy}, $confhash{config_cdr_dao}, $confhash{config_cdr_burnfree}, @wav_array);
print "done.\n";
#
@@ -1374,7 +1379,8 @@
=head1 ENVIRONMENT
MP3Roaster should run on all Unix like operating systems which have Perl and
-cdrecord installed. It has been developed on Debian GNU/Linux.
+a cdrecord-compatible burning application installed. It has been developed on
+Debian GNU/Linux.
=head1 OPTIONS
@@ -1383,6 +1389,10 @@
=over 4
+=item B<-A, --app>
+
+Cdrecord-compatible burning application to use
+
=item B<-d, --dev>
CDR device to use
@@ -1483,6 +1493,16 @@
You see MP3Roaster is really easy to use, this was one of my main goals
while I've written the code: Keep it simple ;)
+=head1 CDRECORD ALTERNATIVES
+
+MP3Roaster can use any cdrecord-compatible burning application as its
+back-end. Known alternatives are wodim, dvdrecord and cdrskin. Wodim and
+dvdrecord are forks of cdrecord. Cdrskin aims to be a drop-in replacement
+which uses no cdrecord code. The cdrecord-compatible application is
+configurable either in the config file or on the command line. Any
+application that accepts cdrecord-style command line syntax and can burn .wav
+files may be specified.
+
=head1 FILES
MP3Roaster can be configured through a system wide and a personal configuration
@@ -1506,7 +1526,7 @@
So if you want to have personal MP3Roaster configuration file just copy
the system wide configuration file to your home directory and edit it.
-=head1 CAVEHEATS
+=head1 CAVEATS
None actually.
@@ -1517,11 +1537,16 @@
=head1 NOTES
-There are currrently no special notes.
+If using cdrskin as the burning back-end, the development version in svn gives best results.
+% svn co http://libburn-svn.pykix.org/trunk libburn
+
+will give you the latest development version of both cdrskin and libburn, which
+is the library that cdrskin uses to burn CD's.
+
=head1 SEE ALSO
-cdrecord.
+cdrskin, libburn, cdrecord, wodim, dvdrecord.
=head1 AUTHOR
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|