-# Return the ARTIST, ALBUM, and DATE tags followed by the TITLE tags
-# in the file FN.
-sub get_tags {
- my $fn = shift;
- my $artists = shift;
- my $titles = shift;
- my $tag;
- my $value;
- my $artist;
- my $album;
- my $date;
- my $discnum;
- my $track;
-
- open(TAGS, '-|', 'metaflac', '--export-vc-to=-', $fn)
- or die("open(metaflac --export-vc-to=- $fn): $!");
- while (<TAGS>) {
- chomp;
-
- ($tag, $value) = split(/=/, $_, 2);
-
- if (/^ARTIST=/i) {
- $artist = $value;
- } elsif (/^ALBUM=/i) {
- $album = $value;
- } elsif (/^DATE=/i) {
- $date = $value;
- } elsif (/^DISCNUMBER=/i) {
- $discnum = int($value);
- } elsif (/^ARTIST\[/i) {
- push(@$artists, $value);
- } elsif (/^TRACKNUMBER=/i) {
- $track = $value;
-
- # Intentionally don't match the = on this one, to support the
- # TITLE[1] .. TITLE[n] tag style.
- } elsif (/^TITLE/i) {
- push(@$titles, $value);
- }
- }
- close(TAGS) or die("close(metaflac --export-vc-to=- $fn): $?");