【发布时间】:2013-08-16 06:30:14
【问题描述】:
我正在尝试利用 Wordpress 对 getID3() 的 3.6 支持,但在将 ID3 标记写入我的 mp3 时遇到问题。这是我正在使用的代码:
if ( ! class_exists( 'getID3' ) ) {
require(ABSPATH.WPINC.'/ID3/getid3.php' );
}
# I had to custom install the write library because WP doesn't include it by default, evidently
getid3_lib::IncludeDependency(TEMPLATEPATH.'/lib/getid3/write.php', __FILE__);
$testfile = "/Users/jplew/Sites/dev.example.com/content/uploads/mp3.mp3";
$tagwriter = new getid3_writetags;
$tagwriter->filename = $testfile;
$tagwriter->tagformats = array('id3v2.4');
$TagData['title'][] = 'My Heart Will Go On';
$TagData['artist'][] = 'Celine Dion';
$TagData['genre'][] = '90s Classics';
$tagwriter->tag_data = $TagData;
if ($tagwriter->WriteTags()) {
echo 'success';
} else {
echo 'failure';
}
我一直在“失败”。 getid3_writetags 函数的路径很好。我知道这一点是因为当我print_r($tagwriter); 时,它会输出指定的所有数组。然而,“警告”和“错误”数组都是空的。
此外,当我执行以下操作时,它会成功返回所有正确的标签信息:
$data = $getid3->analyze( $testfile );
print_r($data)
我还应该注意,演示中包含的demo.write.php 在我运行它时也会失败。它到达starting to write tag(s) 然后停止。
有什么想法吗?我会在 getid3.org 论坛上发帖,但我的 IP 被列入黑名单。 :(
【问题讨论】:
标签: php wordpress id3 id3v2 getid3