won't blow up when some input tags are missing, and takes multiple
operands.
+ * Add DISCNUMBER tag support to fa-flacd and flac2mp3. This is
+ better than putting "(disc 1)" at the end of ALBUM, though that's
+ what ends up happening for mp3s due to lame.
+
Version 2
2004-12-05
svn://diplodocus.org/projects/release/flac-archive-2
my $value;
my $artist;
my $album;
+ my $discnum;
my @tags;
verbose("Opening tags file $fn\n");
} elsif (/^ALBUM=/i) {
$album = $value;
verbose("ALBUM $album from $fn\n"); # cperl-mode sucks "
+ } elsif (/^DISCNUMBER=/i) {
+ $discnum = int($value);
+ verbose("DISCNUMBER $discnum from $fn\n");
}
}
close(TAGS) or die("close($fn): $!");
- return ($artist, $album, @tags);
+ return ($artist, $album, $discnum, @tags);
}
# Process the fa-rip output in the directory DIR.
my $dir = shift;
my $artist;
my $album;
+ my $discnum;
my @tags;
my $outfile;
my $status;
rename("$dir/tags", "$dir/using-tags")
or die("rename($dir/tags, $dir/using-tags): $!");
- ($artist, $album, @tags) = get_tags("$dir/using-tags");
+ ($artist, $album, $discnum, @tags) = get_tags("$dir/using-tags");
verbose("mkdir($artist)\n");
-d $artist or mkdir($artist) or die("mkdir($artist): $!");
chdir($dir) or die("chdir($dir): $!");
$outfile = "$album";
+ defined($discnum) and $outfile .= " (disc $discnum)";
$outfile =~ s/\//_/g;
verbose("Running flac\n");
my $artist;
my $album;
my $date;
+ my $discnum;
my $track;
open(TAGS, '-|', 'metaflac', '--export-vc-to=-', $fn)
$album = $value;
} elsif (/^DATE=/i) {
$date = $value;
+ } elsif (/^DISCNUMBER=/i) {
+ $discnum = int($value);
} elsif (/^ARTIST\[/i) {
push(@$artists, $value);
} elsif (/^TRACKNUMBER=/i) {
}
close(TAGS) or die("close(metaflac --export-vc-to=- $fn): $?");
- return ($artist, $album, $date, $track);
+ return ($artist, $album, $date, $discnum, $track);
}
sub arg {
for my $fn (@ARGV) {
my @args = get_decode_args($fn);
my (@artists, @titles);
- my ($artist, $album, $date, $track) = get_tags($fn, \@artists,
- \@titles);
+ my ($artist, $album, $date, $discnum, $track) = get_tags($fn, \@artists,
+ \@titles);
+
+ # lame doesn't seem to support disc number.
+ defined($discnum) and $album .= " (disc $discnum)";
# Stupid hack: only a single-track file should have the
# TRACKNUMBER tag, so use it if set for the first pass through