+sub main {
+ for my $fn (@_) {
+ my ($tags) = read_tags_metaflac($fn);
+ my ($album, $artist, $date, $discnumber) = disc_tags($tags);
+
+ # TODO resurrect whole-disc FLAC?
+ # 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.
+ # if track == None:
+ # track = 1
+ # else:
+ # track = int(track)
+ {
+ my $tracknumber = epg::flac::archive::tags::one(TRACKNUMBER => $tags);
+ my $title = epg::flac::archive::tags::one(TITLE => $tags);
+ # TODO restore PARTNUMBER and VERSION net time i need them
+ flac2mp3(
+ artist => $artist,
+ album => $album,
+ date => $date,
+ discnumber => $discnumber,
+ track => $tracknumber,
+ title => $title,
+ flac => $fn,
+ )
+ }
+ }