my $discnum;
my @tags;
my $outdir;
- my $outfile;
open(my $fp, '-|', 'metaflac', '--no-utf8-convert', '--export-tags-to=-',
$fn)
close($fp)
or die("close(metaflac --no-utf8-convert --export-tags-to=- $fn): $?");
for ($artist, $album) {
- s/'/'\\''/g;
s|/|_|g;
}
for my $tracknum (sort(map(int, keys(%tracks_to_tags)))) {
my $title = join(' ', map(split, @{$tracks_to_tags{$tracknum}->{'TITLE'}}));
- $title =~ s/'/'\\''/g;
- $title =~ s|/|_|g;
- $outfile = join('/',
- $outdir,
- join(' ',
- (defined($discnum)
- ? sprintf('%02d', $discnum)
- : ()),
- sprintf('%02d', $tracknum),
- $title));
+ my $outfile = join(' ',
+ (defined($discnum)
+ ? sprintf('%02d', $discnum)
+ : ()),
+ sprintf('%02d', $tracknum),
+ $title);
+ $outfile =~ s|/|_|g;
+ $outfile = "$outdir/$outfile";
+ $outfile =~ s/'/'\\''/g;
# If we have ARTIST[n] tags for this track, set @track_artist
# to the empty list; they will go in along with the other [n]
run_or_die(join(' ',
"flac $flac_options -cd $skip_arg $until_arg '$fn'",
" | flac -o '$outfile.flac' -V --no-padding --best",
- map({ s/'/'\\''/g; ('-T', "'$_'") }
+ map({ my $tag = "$_"; $tag =~ s/'/'\\''/g; ('-T', "'$tag'") }
@track_artist,
@tags,
"TRACKNUMBER=$tracknum",