DecMoon has asked for the wisdom of the Perl Monks concerning the following question:
Hi, i've got a problem with package MP3::Tag When I create a new file with a new tag, no problem appears and I can use my beautiful TAG in iTunes or other apps, no problem
But when I try to change some things my script don't retreave anything
#!/usr/bin/perl use Data::Dumper; use MP3::Tag; use utf8; use strict; binmode STDOUT, ":utf8"; binmode STDERR, ":utf8"; MP3::Tag->config(write_v24 => 1); my $audio_file = '/home/decmoon/tmp/test.mp3'; my $name = 'Test tagv2'; my $mp3 = MP3::Tag->new("$audio_file"); print Dumper(\$mp3); my $id3v1 = exists $mp3->{ID3v1} ? $mp3->{ID3v1} : $mp3->new_tag("ID3v +1"); $id3v1->title("$name"); $id3v1->write_tag(); my $id3v2 = exists $mp3->{ID3v2} ? $mp3->{ID3v2} : $mp3->new_tag("ID3v +2"); # my $id3v2 = $mp3->{ID3v2}; print Dumper(\$id3v2); print Dumper(\$id3v2->get_frame_ids); $id3v2->add_frame("TIT2", $name); $id3v2->write_tag(); print Dumper(\$id3v2->get_frame_ids); $mp3->close(); my $mp3 = MP3::Tag->new("$audio_file"); my $id3v2 = exists $mp3->{ID3v2} ? $mp3->{ID3v2} : $mp3->new_tag("ID3v +2"); print Dumper(\$id3v2->get_frame_ids); $mp3->close(); exit;
And output :
$VAR1 = \bless( { 'ofilename' => '/home/decmoon/tmp/test.mp3', '__proxy' => bless( [ ${$VAR1} ], 'MP3::Tag::__proxy' ), 'filename' => bless( { 'filename' => '/home/decmoon +/tmp/test.mp3', 'parent' => ${$VAR1}->{'__pr +oxy'} }, 'MP3::Tag::File' ), 'abs_filename' => '/home/decmoon/tmp/test.mp3' }, 'MP3::Tag' ); $VAR1 = \bless( { 'frame_start' => 0, 'revision' => 0, 'data_size' => 0, 'footer_size' => 0, 'flags' => {}, 'major' => 3, 'frame_major' => 3, 'tag_data' => '', 'tagsize' => 45622, 'buggy_padding_size' => 0, 'version' => '3.0', 'mp3' => bless( { 'parent' => bless( [ bless( { 'ID +3v1' => bless( { + 'mp3' => ${$VAR1}->{'mp3'}, + 'genre' => '', + 'track' => '', + 'title' => 'Test tagv2', + 'genreID' => 255, + 'comment' => '', + 'year' => '', + 'artist' => '', + 'new' => 1, + 'changed' => 1, + 'album' => '' + }, 'MP3::Tag::ID3v1' ), 'of +ilename' => '/home/decmoon/tmp/test.mp3', '__ +proxy' => ${$VAR1}->{'mp3'}->{'parent'}, 'ID +3v2' => ${$VAR1}, 'fi +lename' => ${$VAR1}->{'mp3'}, 'ab +s_filename' => '/home/decmoon/tmp/test.mp3' }, 'M +P3::Tag' ) ], 'MP3::Tag:: +__proxy' ), 'filename' => '/home/decmoon/tmp/ +test.mp3' }, 'MP3::Tag::File' ) }, 'MP3::Tag::ID3v2' ); $VAR1 = \{}; $VAR1 = \{ 'TIT2' => 'Title/songname/content description' }; $VAR1 = \{};
tagv1 seems ok, but not tagv2. So, question, why my 1st and 3rd dumpers for get_frame_ids arent empty ? Or mre precisely, why $mp3->{ID3v2} is always undef?
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Question about MP3::Tag and undef id3v2
by poj (Abbot) on Sep 05, 2017 at 20:18 UTC | |
by DecMoon (Novice) on Sep 06, 2017 at 08:25 UTC | |
|
Re: Question about MP3::Tag and undef id3v2
by tdlewis77 (Sexton) on Sep 05, 2017 at 17:02 UTC | |
by DecMoon (Novice) on Sep 05, 2017 at 17:50 UTC | |
by kcott (Archbishop) on Sep 06, 2017 at 06:12 UTC |