]> diplodocus.org Git - flac-archive/commitdiff
Support multi-artist flac files.
authorepg <>
Tue, 26 Apr 2005 03:30:19 +0000 (03:30 +0000)
committerepg <>
Tue, 26 Apr 2005 03:30:19 +0000 (03:30 +0000)
flac2mp3

index 8964522..f497d6b 100755 (executable)
--- a/flac2mp3
+++ b/flac2mp3
@@ -92,12 +92,13 @@ sub get_decode_args {
 # 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 @titles;
 
     open(TAGS, '-|', 'metaflac', '--export-vc-to=-', $fn)
       or die("open(metaflac --export-vc-to=- $fn): $!");
@@ -112,16 +113,18 @@ sub get_tags {
             $album = $value;
         } elsif (/^DATE=/) {
             $date = $value;
+        } elsif (/^ARTIST\[/) {
+            push(@$artists, $value);
 
         # Intentionally don't match the = on this one, to support the
         # TITLE[1] .. TITLE[n] tag style.
         } elsif (/^TITLE/) {
-            push(@titles, $value);
+            push(@$titles, $value);
         }
     }
     close(TAGS) or die("close(metaflac --export-vc-to=- $fn): $?");
 
-    return ($artist, $album, $date, @titles);
+    return ($artist, $album, $date);
 }
 
 sub flac2mp3 {
@@ -179,11 +182,12 @@ MAIN: {
 
     my $fn = shift or pod2usage();
     my @args = get_decode_args($fn);
-    my ($artist, $album, $date, @titles) = get_tags($fn);
+    my (@artists, @titles);
+    my ($artist, $album, $date) = get_tags($fn, \@artists, \@titles);
 
     for my $i (0..$#titles) {
-        flac2mp3($fn, $titles[$i], $artist, $album, $date, $i + 1,
-                 @{$args[$i]});
+        flac2mp3($fn, $titles[$i], ($artists[$i] or $artist), $album, $date,
+                 $i + 1, @{$args[$i]});
     }
 }