MP3::Tag::ID3v1(3)
π MP3::Tag::ID3v1(3) β the ID3v1 era, but make it make sense
okay so bestie, welcome to MP3::Tag::ID3v1, a module for reading and writing ID3v1 tags of MP3 audio files. it's giving vintage, it's giving 128 bytes of pure nostalgia, and yes we're gonna get through it together π
β¨ NAME β¨
MP3::Tag::ID3v1 β module for reading / writing ID3v1 tags of MP3 audio files. that's the whole assignment, no cap π
πΈ SYNOPSIS πΈ
so here's the thing β MP3::Tag::ID3v1 is designed to be called from the MP3::Tag module, not by you directly being weird about it. like it's a supporting character with main character energy.
use MP3::Tag;
$mp3 = MP3::Tag->new($filename);
# read an existing tag
$mp3->get_tags();
$id3v1 = $mp3->{ID3v1} if exists $mp3->{ID3v1};
# or create a new tag
$id3v1 = $mp3->new_tag("ID3v1");
go check out MP3::Tag for the tea on those functions above, iykyk β¨
π¦ Reading the tag
print " Title: " .$id3v1->title . "\n";
print " Artist: " .$id3v1->artist . "\n";
print " Album: " .$id3v1->album . "\n";
print "Comment: " .$id3v1->comment . "\n";
print " Year: " .$id3v1->year . "\n";
print " Genre: " .$id3v1->genre . "\n";
print " Track: " .$id3v1->track . "\n";
# or at once
@tagdata = $mp3->all();
foreach $tag (@tagdata) {
print $tag;
}
π Changing / Writing the tag
$id3v1->comment("This is only a Test Tag");
$id3v1->title("testing");
$id3v1->artist("Artest");
$id3v1->album("Test it");
$id3v1->year("1965");
$id3v1->track("5");
$id3v1->genre("Blues");
# or at once
$id3v1->all("song title","artist","album","1900","comment",10,"Ska");
$id3v1->write_tag();
π§ Removing the tag from the file
$id3v1->remove_tag();
π AUTHOR π
Thomas Geffert, thg@users.sourceforge.net β the icon who did all this, periodt π
π DESCRIPTION π
title(), artist(), album(), year(), comment(), track(), genre()
$artist = $id3v1->artist;
$artist = $id3v1->artist($artist);
$album = $id3v1->album;
$album = $id3v1->album($album);
$year = $id3v1->year;
$year = $id3v1->year($year);
$comment = $id3v1->comment;
$comment = $id3v1->comment($comment);
$track = $id3v1->track;
$track = $id3v1->track($track);
$genre = $id3v1->genre;
$genre = $id3v1->genre($genre);
use these functions to grab the data out of those fields, or to set the data in. two moods, one function π
quick note: $genre can be a string with the name of the genre, or a number describing the genre. so like, name or number, both slay.
all()
@tagdata = $id3v1->all;
@tagdata = $id3v1->all($title, $artist, $album, $year, $comment, $track, $genre);
returns all the info in the tag, as a list. and yeah, you can also use this sub to set the data of the complete tag β multitasking queen β¨
the order of the data is always title, artist, album, year, comment, track, and genre. no shuffling, bestie, that's the order. and genre has to be a string with the name of the genre, or a number identifying the genre.
fits_tag()
warn "data truncated" unless $id3v1->fits_tag($hash);
checks whether the info in the ID3v1 tag actually fits into the format of the file. vibe check for your tag data π«Ά
as_bin()
$str = $id3v1->as_bin();
returns the ID3v1 tag as a string. raw bytes moment.
write_tag()
$id3v1->write_tag();
[old name: writeTag() . The old name is still available, but you should use the new name]
writes the ID3v1 tag to the file. that's it, that's the function π
remove_tag()
$id3v1->remove_tag();
removes the ID3v1 tag from the file. returns negative on failure, FALSE if no tag was found.
β οΈ caveat time, and it's a real one: only one tag is removed. some β broken β files may have many chain-loaded one after another. so you may need to callremove_tag()in a loop to handle such beasts. like, a littlewhilesituation. you got this πͺ
[old name: removeTag() . The old name is still available, but you should use the new name]
genres()
@allgenres = $id3v1->genres;
$genreName = $id3v1->genres($genreID);
$genreID = $id3v1->genres($genreName);
returns a list of all genres (the whole catalogue, iconic), or the according name or id to a given id or name. bidirectional queen π
new()
$id3v1 = MP3::Tag::ID3v1->new($mp3fileobj[, $create]);
this is generally called from MP3::Tag, because a $mp3fileobj is needed. if $create is true, a new tag is created. otherwise undef is returned if no ID3v1 tag is found in the $mp3obj. π
please use
$mp3 = MP3::Tag->new($filename);
$id3v1 = $mp3->new_tag("ID3v1"); # Empty new tag
or
$mp3 = MP3::Tag->new($filename);
$mp3->get_tags();
$id3v1 = $mp3->{ID3v1}; # Existing tag (if present)
instead of using this function directly. for real, bestie, take the scenic route, not this one π
π SEE ALSO π
MP3::TagMP3::Tag::ID3v2- ID3v1 standard - http://www.id3.org
go read the standard, be a scholar π
π COPYRIGHT π
Copyright (c) 2000-2004 Thomas Geffert. All rights reserved.
this program is free software; you can redistribute it and/or modify it under the terms of the Artistic License, distributed with Perl.
and that's the whole page, babe β¨ tiny little sign-off: this was perl v5.42.3, dated 2022-11-25, and it's MP3::Tag::ID3v1(3) β go forth and tag your MP3s responsibly, mwah π«Άπ
π¦ where this page comes from
- nixos 26.05: perl5.42.3-MP3-Tag 1.16
- nixpkgs unstable: perl5.42.3-MP3-Tag 1.16
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms