]>
diplodocus.org Git - flac-archive/blob - flac2mp3
7 B<flac2mp3> - transcode FLAC file to MP3 files
15 B<flac2mp3> transcodes the FLAC file I<file> to MP3 files. I<file> is
16 the kind of FLAC file B<fa-flacd> generates. That is, it contains a
17 cue sheet, one TITLE tag per track listed therein, and ARTIST, ALBUM,
31 return "$min:$sec.$hun";
38 open(F
, '-|', 'metaflac', '--export-cuesheet-to=-', $fn);
40 /INDEX 01 (\d\d):(\d\d):(\d\d)$/ or next;
41 push(@l, [$1, $2, $3]);
46 my $arg = ["--skip=" . tformat
(@{$l[$i]})];
49 if ($next->[2] == 0) {
50 if ($next->[1] == 0) {
51 push(@$arg, '--until=' . tformat
($next->[0] - 1, 59, 99));
53 push(@$arg, '--until=' . tformat
($next->[0], $next->[1] - 1,
57 push(@$arg, '--until=' . tformat
($next->[0], $next->[1],
67 # Return the ARTIST, ALBUM, and DATE tags followed by the TITLE tags
78 open(TAGS
, '-|', 'metaflac', '--export-vc-to=-', $fn);
82 ($tag, $value) = split(/=/, $_, 2);
91 push(@titles, $value);
94 close(TAGS
) or die("close($fn): $!");
96 return ($artist, $album, $date, @titles);
106 my $skip_arg = shift;
107 my $until_arg = shift;
109 my $outfile = "$artist ($album) $title.mp3";
110 $outfile =~ s/\//_
/g
;
117 system("flac -cd $skip_arg $until_arg '$fn' | lame --preset standard --tt '$title' --ta '$artist' --tl '$album' --ty '$date' --tn $track - '$outfile'");
121 my $fn = shift or pod2usage
();
122 my @args = get_decode_args
($fn);
123 my ($artist, $album, $date, @titles) = get_tags
($fn);
125 for my $i (0..$#titles) {
126 flac2mp3
($fn, $titles[$i], $artist, $album, $date, $i + 1,
136 Written by Eric Gillespie <epg@pretzelnet.org>.
141 # cperl-indent-level: 4
142 # perl-indent-level: 4
143 # indent-tabs-mode: nil
146 # vi: set tabstop=4 expandtab: