initself has asked for the wisdom of the Perl Monks concerning the following question:
Venerable Monks,
I am using MP3::Tag for a very simple operation: parsing the id3v2 tag format into a %02d format for use with id3v1, like so:
#!/usr/bin/perl use warnings; use strict; use Data::Dumper; use MP3::Tag; my $filename = $ARGV[0]; die "Usage: $0 filename" unless $filename; my $mp3 = MP3::Tag->new($filename); $mp3->get_tags(); my $id3v1 = $mp3->{ID3v1} if exists $mp3->{ID3v1}; my $id3v2 = $mp3->{ID3v2} if exists $mp3->{ID3v2}; # Convert id3v2 track format to id3v1 my $track = $id3v2->track; $track = sprintf( "%02d", (split(/\//, $track))[0] ); $id3v1->track($track); $id3v1->write_tag();
Dumping $id3v1 right before the write_tag function shows the track field populated with "01". Dumping the tag after the write shows "1". I have torn apart both MP3::Tag and MP3::Tag::ID3v1 and I just cannot find anything that is truncating this data, althought MP3::Tag does refer to it:
2-digit numbers, or I<number1/number2> with number1,2 up to 999 are allowed for the track number (the leading 0 is stripped);I just can't find where that is actually implemented! Can anyone help me?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: MP3::Tag - Leading zeros on 'track' truncated
by martin (Friar) on Jan 17, 2008 at 11:50 UTC | |
|
Re: MP3::Tag - Leading zeros on 'track' truncated
by Ryszard (Priest) on Jan 17, 2008 at 10:38 UTC | |
by roboticus (Chancellor) on Jan 17, 2008 at 11:18 UTC | |
|
Re: MP3::Tag - Leading zeros on 'track' truncated
by Anonymous Monk on Jan 17, 2008 at 20:22 UTC |