|
From: <lor...@us...> - 2006-10-25 20:47:50
|
Revision: 236
http://svn.sourceforge.net/mp3roaster/?rev=236&view=rev
Author: lorenzo1
Date: 2006-10-25 13:44:57 -0700 (Wed, 25 Oct 2006)
Log Message:
-----------
Added a patch by Art Sacket to read the list of files to be burned from a file.
Modified Paths:
--------------
trunk/mp3roaster/mp3roaster.pl
Modified: trunk/mp3roaster/mp3roaster.pl
===================================================================
--- trunk/mp3roaster/mp3roaster.pl 2006-10-24 23:25:04 UTC (rev 235)
+++ trunk/mp3roaster/mp3roaster.pl 2006-10-25 20:44:57 UTC (rev 236)
@@ -51,6 +51,7 @@
\%opthash,
'opt_cdr_dev|dev|D=s',
+ 'opt_file_list|list|L=s',
'opt_cdr_speed|speed|s=i',
'opt_cdr_dummy|dummy|d',
'opt_cdr_dao|dao|a',
@@ -98,6 +99,7 @@
-q, --quotes Replace quotes with underscores.
-Q, --questions Replace questionmarks with underscores.
-n, --normalize Normalize WAV files before burning.
+ -L, --list Read file names from <file> instead of command line.
-v, --verbose Enable verbose output.
-h, --help Show this help screen.
-V, --version Show program version.
@@ -358,8 +360,15 @@
my @file_array; # the file array
my $i = 0; # a simple counter
- foreach my $file (@ARGV) {
+ my @arg = @ARGV;
+ if (exists $opthash{'opt_file_list'} && defined $opthash{'opt_file_list'} && length $opthash{'opt_file_list'}) {
+ @arg = ();
+ @arg = get_file_list();
+ }
+
+ foreach my $file (@arg) {
+
if (-r $file) {
if (defined check_file_type($file)) {
@@ -1107,7 +1116,54 @@
return $i;
}
+
# }}}
+# {{{ sub get_file_list{}
+
+#
+# get_file_list
+#
+# Get list of file names from a file instead of args.
+#
+sub get_file_list {
+ my @list = ();
+ if (exists $opthash{'opt_file_list'} && defined $opthash{'opt_file_list'} && length $opthash{'opt_file_list'}) {
+ if (!-e $opthash{'opt_file_list'}) {
+ die print_error('GET_FILE_LIST', "file list $opthash{'opt_file_list'} does not exist");
+ } elsif (!-r $opthash{'opt_file_list'}) {
+ die print_error('GET_FILE_LIST', "file list $opthash{'opt_file_list'} is not readable");
+ } elsif (-z $opthash{'opt_file_list'}) {
+ die print_error('GET_FILE_LIST', "file list $opthash{'opt_file_list'} is empty");
+ }
+ if (open(LIST, "<$opthash{'opt_file_list'}")) {
+ while (<LIST>) {
+ chomp;
+ s/#.*$//;
+ s/^\s+//;
+ s/\s+$//;
+ if (!length $_) {
+ next;
+ }
+ if (-e $_ && -r _ && -s _) {
+ push(@list, $_);
+ } else {
+ die print_error('GET_FILE_LIST', "file $_ does not exist");
+ }
+ }
+ close LIST;
+ } else {
+ die "Failed to open $opthash{'opt_file_list'} for reading: $!";
+ }
+ }
+ if (wantarray()) {
+ return @list;
+ } else {
+ return \@list;
+ }
+}
+
+
+# }}}
# {{{ main{}
#
@@ -1139,7 +1195,7 @@
my @file_array;
my @wav_array;
- if (@ARGV) {
+ if (@ARGV || (defined $opthash{'opt_file_list'} && length $opthash{'opt_file_list'})) {
print "$def{appname} $def{version} ($def{cvs_revision}).\n\n";
@@ -1379,6 +1435,10 @@
Normalize WAV files before burning
+=item B<-L, --list>
+
+Read file names from <file> instead of command line
+
=item B<-v, --verbose>
Enable verbose output
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|