The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

MP3::Info::set_mp3v2tag - Set MP3 V2 tags for MP3-files

SYNOPSIS

Using a hashref

    #!perl -w
    use MP3::Info::set_mp3v2tag;

    my $file = "/tmp/music.mp3";
    my %tags;

    $tags{"TIT2"} = "Song title";
    $tags{"TPE1"} = "Who sings it";
        
    set_mp3v2tag($file,\%tst);

  You may also use V1 tag-names to set the corresponding V2 tags

    #!perl -w
    use MP3::Info::set_mp3v2tag;

    my $file = "/tmp/music.mp3";
    my %tags;

    $tags{"TITLE"} = "Song title";
    $tags{"ARTIST"} = "Who sings it";
        
    set_mp3v2tag($file,\%tst);

  Using comma-separated arguments
    #!perl -w
    use MP3::Info::set_mp3v2tag;

    my $file = "/tmp/music.mp3";
    set_mp3v2tag($file,"title","artist","album","2002","This is a test",
                      "genre", 0);

  Using an array or a list
    #!perl -w
    use MP3::Info::set_mp3v2tag;

    my $file = "/tmp/music.mp3";
    set_mp3v2tag($file, qw /TITLE ARTIST ALBUM 0000 COMMENT GENRE 0/);

AUTHOR

Benno Kardel, perlfan@justmail.de

I would like to thank Thomas Gefferts for his MP3::Tag module, which does the ID3v2 tag writing on behalf of this wrapper. Also I would like to thank Chris Nandor for his MP3::Info module which does a splendid job (except that it cannot write ID3v2 tags) and is easy to use. Without that module I would never have written this one.

DESCRIPTION

MP3::Info::set_mp3v2tag is only a little wrapper around Thomas Gefferts MP3::Tag module. MP3::Info::set_mp3v2tag is mainly thought as an extension to Chris Nandors MP3::Info module to which it adds support for writing ID3v2 tags

set_mp3v2tag (FILE, TITLE, ARTIST, ALBUM, YEAR, COMMENT, GENRE [, TRACKNUM])
set_mp3v2tag (FILE, $HASHREF)

Adds/changes V2 tag information in an MP3 audio file. Will clobber any existing information in file.

Fields are TITLE, ARTIST, ALBUM, YEAR, COMMENT, GENRE (which indeed will be converted to their corresponding ID3V23 fields).

HISTORY

I was looking for a comfortable way to read and write ID3 tags in PERL and found the MP3::Info package at CPAN which does quite a good job.

Unfortunately it lacked support for writing ID3V2 tags.

So I looked again at CPAN and found the MP3::Tag package which supports it, but has a somewhat lower-level interface than MP3::Info. My application was halfway written and already used MP3::Info::set_mp3_tag calls, so I wrote a little wrapper which provides the set_mp3v2tag routine quite similar to MP3::Info::set_mp3_tag.

I am far from being an expert in MP3-tags, and this little wrapper completely relies on MP3::Tag and my - may be not so perfect - understanding of it. Still I hope there are no disastrous bugs in this software.

SUPPORTED ID3v2 tags

Since this little wrapper totally depends on Thomas Jeffert's MP3::Tag:ID3v2 you need to have a look at the MP3::Tag:ID3v2-Data man-page to find out which tags are actually supported.

SEE ALSO

MP3::Info, MP3::Tag, MP3::Tag::ID3v2, MP3::Tag::ID3v2-Data

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 88:

'=item' outside of any '=over'

Around line 98:

You forgot a '=back' before '=head1'