MP3::Tag::File - Module for reading / writing files
my $mp3 = MP3::Tag->new($filename);
($song, $artist, $no, $album) = $mp3->read_filename();
see MP3::Tag
MP3::Tag::File is designed to be called from the MP3::Tag module.
It offers possibilities to read/write data from files.
($song, $artist, $no, $album) = $mp3->read_filename($what, $filename);
read_filename()
tries to extract information about artist,
song, song number and album from the filename.
This is likely to fail for a lot of filenames, especially the album will be often wrongly guessed, as the name of the parent directory is taken as album name.
$what
and $filename
are optional.
$what
maybe song, track, artist or album. If
$what
is defined read_filename will return only this element.
If $filename
is defined this filename will be used and not the
real filename which was set by MP3::Tag with MP3::Tag-
new($filename)>.
Following formats will be hopefully recognized:
- album name/artist name - song name.mp3
- album_name/artist_name-song_name.mp3
- album.name/artist.name_song.name.mp3
- album name/(artist name) song name.mp3
- album name/01. artist name - song name.mp3
- album name/artist name - 01 - song.name.mp3
$song = $mp3->song($filename);
Returns the song name, guessed from the filename. See also
read_filename()
$filename
is optional and will be used instead of the real
filename if defined.
$artist = $mp3->artist($filename);
Returns the artist name, guessed from the filename. See also
read_filename()
$filename
is optional and will be used instead of the real
filename if defined.
$track = $mp3->track($filename);
Returns the track number, guessed from the filename. See also
read_filename()
$filename
is optional and will be used instead of the real
filename if defined.
$album = $mp3->artist($album);
Returns the album name, guessed from the filename. See also
read_filename()
The album name is guessed from the parent
directory, so it is very likely to fail.
$filename
is optional and will be used instead of the real
filename if defined.