note 102283 added to function.id3-get-tag
| From: | Yoshi2889 at osu1 dot php dot net | Date: | Sun, 06 Feb 2011 12:33:17 +0000 |
| Subject: | note 102283 added to function.id3-get-tag | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-176714@lists.php.net to get a copy of this message | ||
An alternative to this is
<?php
function readID3($filename)
{
$mp3 = $filename;
$genre_arr = array("Blues", "Classic Rock", "Country",
"Dance", "Disco", "Funk", "Grunge", "Hip-Hop",
"Jazz", "Metal", "New Age", "Oldies", "Other",
"Pop", "R&B", "Rap", "Reggae", "Rock",
"Techno", "Industrial", "Alternative", "Ska", "Death
Metal", "Pranks", "Soundtrack", "Euro-Techno",
"Ambient", "Trip-Hop", "Vocal", "Jazz+Funk",
"Fusion", "Trance", "Classical", "Instrumental",
"Acid", "House", "Game", "Sound Clip", "Gospel",
"Noise", "AlternRock", "Bass", "Soul", "Punk",
"Space", "Meditative", "Instrumental Pop", "Instrumental
Rock", "Ethnic", "Gothic", "Darkwave",
"Techno-Industrial", "Electronic", "Pop-Folk", "Eurodance",
"Dream", "Southern Rock", "Comedy", "Cult",
"Gangsta", "Top 40", "Christian Rap", "Pop/Funk",
"Jungle", "Native American", "Cabaret", "New Wave",
"Psychadelic", "Rave", "Showtunes", "Trailer",
"Lo-Fi", "Tribal", "Acid Punk", "Acid Jazz",
"Polka", "Retro", "Musical", "Rock & Roll", "Hard
Rock", "Folk", "Folk-Rock", "National Folk", "Swing",
"Fast Fusion", "Bebob", "Latin", "Revival",
"Celtic", "Bluegrass", "Avantgarde", "Gothic Rock",
"Progressive Rock", "Psychedelic Rock", "Symphonic Rock", "Slow
Rock", "Big Band", "Chorus", "Easy Listening",
"Acoustic", "Humour", "Speech", "Chanson",
"Opera", "Chamber Music", "Sonata", "Symphony", "Booty
Bass", "Primus", "Porn Groove", "Satire", "Slow Jam",
"Club", "Tango", "Samba", "Folklore", "Ballad",
"Power Ballad", "Rhythmic Soul", "Freestyle", "Duet",
"Punk Rock", "Drum Solo", "Acapella", "Euro-House",
"Dance Hall");
$filesize = filesize($mp3);
$file = fopen($mp3, "r");
fseek($file, -128, SEEK_END);
$tag = fread($file, 3);
if($tag == "TAG")
{
$data["Song"] = fread($file, 30);
$data["Artist"] = fread($file, 30);
$data["Album"] = fread($file, 30);
$data["Year"] = fread($file, 4);
$data["Comment"] = fread($file, 30);
$data["Genre"] = $genre_arr[ord(fread($file, 1))];
}
else
return("MP3 file does not have any ID3 tag!");
fclose($file);
while(list($key, $value) = each($data))
{
echo("$key: $value<br>\r\n");
}
}
?>
It's a bit more code but does the job fine.
----
Server IP: 69.147.83.197
Probable Submitter: 84.31.25.23
----
Manual Page -- http://www.php.net/manual/en/function.id3-get-tag.php
Edit -- https://master.php.net/note/edit/102283
Del: integrated -- https://master.php.net/note/delete/102283/integrated
Del: useless -- https://master.php.net/note/delete/102283/useless
Del: bad code -- https://master.php.net/note/delete/102283/bad+code
Del: spam -- https://master.php.net/note/delete/102283/spam
Del: non-english -- https://master.php.net/note/delete/102283/non-english
Del: in docs -- https://master.php.net/note/delete/102283/in+docs
Del: other reasons-- https://master.php.net/note/delete/102283
Reject -- https://master.php.net/note/reject/102283
Search -- https://master.php.net/manage/user-notes.php