]> diplodocus.org Git - flac-archive/commitdiff
Add support for reading release dates from MusicBrainz.
authorepg <>
Sun, 26 Jun 2005 18:09:36 +0000 (18:09 +0000)
committerepg <>
Sun, 26 Jun 2005 18:09:36 +0000 (18:09 +0000)
Thanks to Matthias Friedrich <matt@mafr.de> for adding this to
MusicBrainz::Client::Simple and suggesting it.

fa-rip

diff --git a/fa-rip b/fa-rip
index f327645..5066c79 100755 (executable)
--- a/fa-rip
+++ b/fa-rip
@@ -86,6 +86,7 @@ sub tags_file {
     my $various = shift;
     my $artist = shift;
     my $album = shift;
+    my $release_dates = shift;
     my $fh;
     my $i;
     my $track;
@@ -94,8 +95,14 @@ sub tags_file {
     open($fh, '>', $fn) or die("open('>$fn'): $!");
     print($fh 'ARTIST=', (defined($artist) and $artist or ''), "\n");
     print($fh 'ALBUM=', (defined($album) and $album or ''), "\n");
-    # MusicBrainz doesn't have dates yet; these are usually wrong anyway.
-    print($fh "DATE=\n");
+
+    if (defined($release_dates) and %$release_dates) {
+        while (my ($country, $date) = each(%$release_dates)) {
+            print($fh "DATE[$country]=$date\n");
+        }
+    } else {
+        print($fh "DATE=\n");
+    }
 
     for $i (1 .. $trackcount) {
         $various and print($fh "ARTIST[$i]=\n");
@@ -143,9 +150,10 @@ sub tags {
             }
         }
 
+        my %dates = $album->get_release_dates;
         tags_file("candidate-tags-$i", $trackcount, $various,
                   $album->get_artist->get_name, $album->get_name,
-                  $album->get_tracks);
+                  \%dates, $album->get_tracks);
     }
 }