如何从mp3文件中获取元数据 [英] How to get meta data out of mp3 files
本文介绍了如何从mp3文件中获取元数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以推荐一个好的独立类(不是PEAR的一部分)还是我可以从大约1,400个MP3文件中获取一些基本元数据的其他方法吗?
Can anyone recommend a good standalone class (not part of PEAR) or another method for me to grab some basic meta data from about 1,400 MP3 files?
推荐答案
http://getid3.sourceforge.net/
可同时使用ID3 v1和V2.读取的内容不仅限于id3,还应能满足要求.您还可以使用从 http://www.htmlhelpcentral.com/messageboard/showthread.php?t = 12006
Works with both ID3 v1 and V2. Reads more than just id3 but should fit the bill. You can also play with the following taken from http://www.htmlhelpcentral.com/messageboard/showthread.php?t=12006
<?
class CMP3File {
var $title;var $artist;var $album;var $year;var $comment;var $genre;
function getid3 ($file) {
if (file_exists($file)) {
$id_start=filesize($file)-128;
$fp=fopen($file,"r");
fseek($fp,$id_start);
$tag=fread($fp,3);
if ($tag == "TAG") {
$this->title=fread($fp,30);
$this->artist=fread($fp,30);
$this->album=fread($fp,30);
$this->year=fread($fp,4);
$this->comment=fread($fp,30);
$this->genre=fread($fp,1);
fclose($fp);
return true;
} else {
fclose($fp);
return false;
}
} else { return false; }
}
}
?>
这篇关于如何从mp3文件中获取元数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文