my $fn = shift;
my @l;
- open(F, '-|', 'metaflac', '--export-cuesheet-to=-', $fn);
+ open(F, '-|', 'metaflac', '--no-utf8-convert', '--export-cuesheet-to=-',
+ $fn);
while (<F>) {
/INDEX 01 (\d\d):(\d\d):(\d\d)$/ or next;
push(@l, [$1, $2, $3]);
my $discnum;
my @tags;
my $outdir;
- my $outfile;
- open(my $fp, '-|', 'metaflac', '--export-tags-to=-', $fn)
- or die("open(metaflac --export-tags-to=- $fn): $!");
+ open(my $fp, '-|', 'metaflac', '--no-utf8-convert', '--export-tags-to=-',
+ $fn)
+ or die("open(metaflac --no-utf8-convert --export-tags-to=- $fn): $!");
($artist, $album, $discnum, @tags) = get_tags($fp, $fn);
- close($fp) or die("close(metaflac --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",