Hi all, I am trying to change the ALBUM and GENRE tag values in mp3 files. My code changes ALBUM but does not change GENRE. Could you perhaps assist me in getting it to change GENRE too?
use strict; use warnings; use MP3::Info; use Time::Piece; my $date = localtime->strftime('%Y/%m/%d'); my $file = 'file.mp3'; my $tag->{ALBUM} = $date; # Change album to today;s date set_mp3tag($file, $tag); $tag->{GENRE} = "Audiobook"; # Change genre to Audiobook set_mp3tag($file, $tag); my $info = get_mp3info($file); printf "$file length is %d:%d\n", $info->{MM}, $info->{SS};
When I look at the mp3 file in mp3tag ( http://www.mp3tag.de/ ), I can change the GENRE without a problem. Mp3tag tells me the tags are: IDv2.3 (ID3v1 ID3v2.3). When I run the code below to see if I can see what tags actually appear in the mp3, I cannot find the actual genre tag value that appears in mp3tag. That is, if I change GENRE to Audiobook in mp3tag, the word Audiobook does not appear in the output of this code below.
use MP3::Tag; use warnings; use strict; use Data::Dumper; open FILE, ">mp3.txt" or die $!; my $file = 'file.mp3'; my $mp3 = MP3::Tag->new($file); $mp3->get_tags(); print FILE Dumper($mp3);
Thanks for your time.

In reply to use MP3::Info to change .mp3 genre by Evyn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.