]>
diplodocus.org Git - flac-archive/blob - flac2mp3
bd39bbe0cc438b50334675c4e8f7a60a5b9ad5d5
5 B<flac2mp3> - transcode FLAC file to MP3 files
9 B<flac2mp3> [B<--lame-options> I<lame-options>] [B<-q>] [B<-v>] I<file> [...]
13 B<flac2mp3> transcodes the FLAC files I<file> to MP3 files. I<file>
14 may be the kind of FLAC file B<fa-flacd> generates. That is, it
15 contains a cue sheet, one TITLE tag per track listed therein, and
16 ARTIST, ALBUM, and DATE tags.
18 Note that lame is retarded, and parses B<LANG> directly itself! So, in order
19 for it to transcode textual tags, you must specify the encoding in LANG, e.g.
26 =item B<--lame-options> I<lame-options>
28 Pass I<lame-options> to B<lame>. This ends up being passed to the
29 shell, so feel free to take advantage of that. You'll almost
30 certainly have to put I<lame-options> in single quotes.
32 =item B<-q> [B<--quiet>]
34 Suppress status information. This option is passed along to B<flac>
37 =item B<-v> [B<--verbose>]
39 Print diagnostic information. This option is passed along to B<flac>
46 Written by Eric Gillespie <epg@pretzelnet.org>.
50 package epg
::flac
::archive
::mp3
;
58 require "$FindBin::Bin/tags.pl";
59 epg
::flac
::archive
::tags-
>import(
70 my @quoted_pic_options = ();
71 # (fd, picfn) = tempfile.mkstemp()
73 # p = Popen(['metaflac', '--export-picture-to', picfn, unquoted_fn],
76 # stderr = ''.join(p.stderr)
77 # # Hacky check for flac with no album art
78 # if 'no PICTURE block' in stderr:
79 # # That's fine, just no picture.
83 # sys.stderr.write('metaflac exited %d: %s\n' % (status, stderr))
85 # pic_options = "--ti '%s'" % picfn
87 # This is an old TODO; what's wrong with --ty ?
88 # TODO: Look at TDOR, TDRL, TDRC for date.
97 '--pad-id3v2-size', 0,
110 (map { ('--tv', quote
("TPE2=$_")) } @{$a{albumartist
}}),
111 (map { ('--tv', quote
("TPOS=$_")) } @{$a{discnumber
}}),
114 mangle_for_file_name
(
118 (map { sprintf('%02d', $_) } @{$a{discnumber
}}),
127 sub read_tags_metaflac
{
129 open(my $fh, '-|', 'metaflac', '--no-utf8-convert', '--export-tags-to=-', $fn) || die("metalfac: $!");
130 my @result = read_tags
($fh);
133 die("metaflac exited $?")
135 die("close(metaflac): $!")
142 my ($tags) = read_tags_metaflac
($fn);
143 my ($album, $artist, $date, $discnumber) = disc_tags
($tags);
145 # TODO resurrect whole-disc FLAC?
146 # Stupid hack: only a single-track file should have the
147 # TRACKNUMBER tag, so use it if set for the first pass through
148 # the loop. At the end of the loop, we'll set $track for the
149 # next run, so this continues to work for multi-track files.
155 my $tracknumber = epg
::flac
::archive
::tags
::one
(TRACKNUMBER
=> $tags);
156 my $title = epg
::flac
::archive
::tags
::one
(TITLE
=> $tags);
157 # TODO restore PARTNUMBER and VERSION net time i need them
162 discnumber
=> $discnumber,
163 track
=> $tracknumber,