From afd5c800325a3b0e0f3b114850dac8799bb1a97f Mon Sep 17 00:00:00 2001 From: epg <> Date: Wed, 27 Apr 2005 05:07:00 +0000 Subject: [PATCH] Don't stupidly take only one argument; take multiple files. --- flac2mp3 | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/flac2mp3 b/flac2mp3 index 69869a4..092f5a1 100755 --- a/flac2mp3 +++ b/flac2mp3 @@ -8,14 +8,14 @@ B - transcode FLAC file to MP3 files =head1 SYNOPSIS -B [B<--lame-options> I] [B<-q>] [B<-v>] I +B [B<--lame-options> I] [B<-q>] [B<-v>] I [...] =head1 DESCRIPTION -B transcodes the FLAC file I to MP3 files. I is -the kind of FLAC file B generates. That is, it contains a -cue sheet, one TITLE tag per track listed therein, and ARTIST, ALBUM, -and DATE tags. +B transcodes the FLAC files I to MP3 files. I +may be the kind of FLAC file B generates. That is, it +contains a cue sheet, one TITLE tag per track listed therein, and +ARTIST, ALBUM, and DATE tags. =cut @@ -200,21 +200,24 @@ MAIN: { ) or pod2usage(); $help and pod2usage(-exitstatus=>0, -verbose=>1); - my $fn = shift or pod2usage(); - my @args = get_decode_args($fn); - my (@artists, @titles); - my ($artist, $album, $date, $track) = get_tags($fn, \@artists, \@titles); - - # Stupid hack: only a single-track file should have the - # TRACKNUMBER tag, so use it if set for the first pass through the - # loop. At the end of the loop, we'll set $track for the next - # run, so this continues to work for multi-track files. - $track ||= 1; - - for my $i (0..$#titles) { - flac2mp3($fn, $titles[$i], ($artists[$i] or $artist), $album, $date, - $track, (defined($args[$i]) and @{$args[$i]} or '')); - $track = $i + 2; + @ARGV or pod2usage(); + for my $fn (@ARGV) { + my @args = get_decode_args($fn); + my (@artists, @titles); + my ($artist, $album, $date, $track) = get_tags($fn, \@artists, + \@titles); + + # Stupid hack: only a single-track file should have the + # TRACKNUMBER tag, so use it if set for the first pass through + # the loop. At the end of the loop, we'll set $track for the + # next run, so this continues to work for multi-track files. + $track ||= 1; + + for my $i (0..$#titles) { + flac2mp3($fn, $titles[$i], ($artists[$i] or $artist), $album, $date, + $track, (defined($args[$i]) and @{$args[$i]} or '')); + $track = $i + 2; + } } } -- 2.56.0