Attached is the patch for Audio::File to handle disc id tags. There has
been no action on this bug for over a year so I'm trying again. If the
patch is not applied an explanation of why that decision was made would
be greatly appreciated. Thanks.
diff -Naur Audio.old/File/Flac/Tag.pm Audio.new/File/Flac/Tag.pm
--- Audio.old/File/Flac/Tag.pm	2006-09-23 10:48:30.612465104 -0700
+++ Audio.new/File/Flac/Tag.pm	2006-09-23 10:46:27.120926424 -0700
@@ -15,11 +15,12 @@
 	$self->title(	$flactag->{TITLE}		);
 	$self->artist(	$flactag->{ARTIST}		);
 	$self->album(	$flactag->{ALBUM}		);
-	$self->comment(	$flactag->{DESCRIPTION}	);
+	$self->comment(	$flactag->{DESCRIPTION}	        );
 	$self->genre(	$flactag->{GENRE}		);
 	$self->year(	$flactag->{DATE}		);
-	$self->track(	$flactag->{TRACKNUMBER}	);
-	$self->total(	$flactag->{TRACKTOTAL}	);
+	$self->track(	$flactag->{TRACKNUMBER}	        );
+	$self->disc(    $flactag->{DISCNUMBER}          );
+	$self->total(	$flactag->{TRACKTOTAL}	        );
 
 	return 1;
 }
diff -Naur Audio.old/File/Mp3/Tag.pm Audio.new/File/Mp3/Tag.pm
--- Audio.old/File/Mp3/Tag.pm	2006-09-23 10:48:30.628465563 -0700
+++ Audio.new/File/Mp3/Tag.pm	2006-09-23 10:46:27.076925163 -0700
@@ -25,6 +25,25 @@
 	$self->track  (	substr($track, 0, $pos)  );
 	$self->total  (	substr($track, $pos + 1) );
 
+	if (exists $self->{mp3}->{ID3v2}) {
+	  my $disctag = 0;
+	  if ($self->{mp3}->{ID3v2}->get_frame("TPA")) {
+	    $disctag = $self->{mp3}->{ID3v2}->get_frame("TPA");
+	  }elsif ($self->{mp3}->{ID3v2}->get_frame("TPOS")) {
+	    $disctag = $self->{mp3}->{ID3v2}->get_frame("TPOS");
+	  }else {
+	    return 1;
+	  }
+	  my $disctotal = 0;
+	  my $disc = 0;
+	  if ($disctag =~ /\//) {
+	    ($disc, $disctotal) = split(/\//,$disctag,2);
+	  }else {
+	    $disc = $disctag;
+	  }
+	  $self->disc ( $disc );
+	}
+
 	return 1;
 }
 
diff -Naur Audio.old/File/Ogg/Tag.pm Audio.new/File/Ogg/Tag.pm
--- Audio.old/File/Ogg/Tag.pm	2006-09-23 10:48:30.588464416 -0700
+++ Audio.new/File/Ogg/Tag.pm	2006-09-23 10:46:27.092925621 -0700
@@ -17,7 +17,8 @@
 	$self->comment(	$self->{ogg}->comment('comment')		);
 	$self->genre(	$self->{ogg}->comment('genre')			);
 	$self->year(	$self->{ogg}->comment('date')			);
-	$self->track(	$self->{ogg}->comment('tracknumber')	);
+	$self->track(	$self->{ogg}->comment('tracknumber')    	);
+	$self->disc(    $self->{ogg}->comment('discnumber')             );
 	$self->total(	$self->{ogg}->comment('tracktotal')		);
 
 	return 1;
diff -Naur Audio.old/File/Tag.pm Audio.new/File/Tag.pm
--- Audio.old/File/Tag.pm	2006-09-23 10:48:30.572463958 -0700
+++ Audio.new/File/Tag.pm	2006-09-23 10:46:27.192928487 -0700
@@ -50,8 +50,8 @@
 Using title() you can get or set the tags title field. If called without any
 argument it'll return the current content of the title field. If you call
 title() with an scalar argument it will set the title field to what the argument
-contains. The methods artist(), album(), comment(), genre(), year(), track() and total()
-are called in the same way.
+contains. The methods artist(), album(), comment(), genre(), year(), track(), disc()
+and total() are called in the same way.
 
 =cut
 
@@ -158,8 +158,23 @@
 		$self->{track} = shift;
 		return 1;
 	}
-	
 	return $self->{track} + 0;
+}
+
+=head2 disc
+
+Set/get the disc field in the files tag.
+
+=cut
+
+sub disc {
+	my $self = shift;
+	if ( @_ ) {
+		$self->{disc} = shift;
+		return 1;
+	}
+
+	return $self->{disc};
 
 }
 
@@ -204,6 +219,7 @@
 		genre	=> $self->genre(),
 		year	=> $self->year(),
 		track	=> $self->track(),
+		disc    => $self->disc(),
 		total	=> $self->total()
 	};
 }
@@ -223,6 +239,7 @@
 			$self->genre() &&
 			$self->year() &&
 			$self->track() &&
+		        $self->disc() &&
 			$self->total());
 }
 

Reply via email to