【发布时间】:2011-06-10 05:21:26
【问题描述】:
谁能推荐一个好的独立类(不是 PEAR 的一部分)或其他方法让我从大约 1,400 个 MP3 文件中获取一些基本元数据?
【问题讨论】:
-
如果需要,pear.php.net/package/MP3_IDv2 可以完美地用作“独立类”。
谁能推荐一个好的独立类(不是 PEAR 的一部分)或其他方法让我从大约 1,400 个 MP3 文件中获取一些基本元数据?
【问题讨论】:
http://getid3.sourceforge.net/
适用于 ID3 v1 和 V2。阅读的不仅仅是 id3,但应该符合要求。您还可以玩取自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; }
}
}
?>
【讨论】: