]> diplodocus.org Git - flac-archive/commitdiff
Add DISCNUMBER support.
authorepg <>
Wed, 27 Apr 2005 06:10:09 +0000 (06:10 +0000)
committerepg <>
Wed, 27 Apr 2005 06:10:09 +0000 (06:10 +0000)
CHANGES
fa-flacd
flac2mp3

diff --git a/CHANGES b/CHANGES
index 39d09c09793a988707611b90045674bb10957b6f..5ace0bde5d414569a78d64ae68fb66cafe5351c4 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -10,6 +10,10 @@ svn://diplodocus.org/projects/release/flac-archive-3
     won't blow up when some input tags are missing, and takes multiple
     operands.
 
     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
 Version 2
 2004-12-05
 svn://diplodocus.org/projects/release/flac-archive-2
index d378a1b42cd54a2478f9dce6d7175547d25ab610..3c3637241b12b2ea8cac3b8227cf8572a4e18ead 100755 (executable)
--- a/fa-flacd
+++ b/fa-flacd
@@ -38,6 +38,7 @@ sub get_tags {
     my $value;
     my $artist;
     my $album;
     my $value;
     my $artist;
     my $album;
+    my $discnum;
     my @tags;
 
     verbose("Opening tags file $fn\n");
     my @tags;
 
     verbose("Opening tags file $fn\n");
@@ -54,11 +55,14 @@ sub get_tags {
         } elsif (/^ALBUM=/i) {
             $album = $value;
             verbose("ALBUM $album from $fn\n"); # cperl-mode sucks "
         } 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): $!");
 
         }
     }
     close(TAGS) or die("close($fn): $!");
 
-    return ($artist, $album, @tags);
+    return ($artist, $album, $discnum, @tags);
 }
 
 # Process the fa-rip output in the directory DIR.
 }
 
 # Process the fa-rip output in the directory DIR.
@@ -66,6 +70,7 @@ sub flac {
     my $dir = shift;
     my $artist;
     my $album;
     my $dir = shift;
     my $artist;
     my $album;
+    my $discnum;
     my @tags;
     my $outfile;
     my $status;
     my @tags;
     my $outfile;
     my $status;
@@ -74,7 +79,7 @@ sub flac {
     rename("$dir/tags", "$dir/using-tags")
       or die("rename($dir/tags, $dir/using-tags): $!");
 
     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): $!");
 
     verbose("mkdir($artist)\n");
     -d $artist or mkdir($artist) or die("mkdir($artist): $!");
@@ -83,6 +88,7 @@ sub flac {
     chdir($dir) or die("chdir($dir): $!");
 
     $outfile = "$album";
     chdir($dir) or die("chdir($dir): $!");
 
     $outfile = "$album";
+    defined($discnum) and $outfile .= " (disc $discnum)";
     $outfile =~ s/\//_/g;
 
     verbose("Running flac\n");
     $outfile =~ s/\//_/g;
 
     verbose("Running flac\n");
index c0cce30a5ab06a7b8de6d5e80df507c89435ca4e..ab83c9f9528110eeab7a55fcc6b7ba8e10d63ea0 100755 (executable)
--- a/flac2mp3
+++ b/flac2mp3
@@ -104,6 +104,7 @@ sub get_tags {
     my $artist;
     my $album;
     my $date;
     my $artist;
     my $album;
     my $date;
+    my $discnum;
     my $track;
 
     open(TAGS, '-|', 'metaflac', '--export-vc-to=-', $fn)
     my $track;
 
     open(TAGS, '-|', 'metaflac', '--export-vc-to=-', $fn)
@@ -119,6 +120,8 @@ sub get_tags {
             $album = $value;
         } elsif (/^DATE=/i) {
             $date = $value;
             $album = $value;
         } elsif (/^DATE=/i) {
             $date = $value;
+        } elsif (/^DISCNUMBER=/i) {
+            $discnum = int($value);
         } elsif (/^ARTIST\[/i) {
             push(@$artists, $value);
         } elsif (/^TRACKNUMBER=/i) {
         } elsif (/^ARTIST\[/i) {
             push(@$artists, $value);
         } elsif (/^TRACKNUMBER=/i) {
@@ -132,7 +135,7 @@ sub get_tags {
     }
     close(TAGS) or die("close(metaflac --export-vc-to=- $fn): $?");
 
     }
     close(TAGS) or die("close(metaflac --export-vc-to=- $fn): $?");
 
-    return ($artist, $album, $date, $track);
+    return ($artist, $album, $date, $discnum, $track);
 }
 
 sub arg {
 }
 
 sub arg {
@@ -210,8 +213,11 @@ MAIN: {
     for my $fn (@ARGV) {
         my @args = get_decode_args($fn);
         my (@artists, @titles);
     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
 
         # Stupid hack: only a single-track file should have the
         # TRACKNUMBER tag, so use it if set for the first pass through