本文整理汇总了PHP中getid3_id3v1::Analyze方法的典型用法代码示例。如果您正苦于以下问题:PHP getid3_id3v1::Analyze方法的具体用法?PHP getid3_id3v1::Analyze怎么用?PHP getid3_id3v1::Analyze使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类getid3_id3v1
的用法示例。
在下文中一共展示了getid3_id3v1::Analyze方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: write
public function write()
{
// remove existing apetag
$this->remove();
$engine = new getid3();
$engine->filename = $this->filename;
$engine->fp = fopen($this->filename, 'rb');
$engine->include_module('tag.id3v1');
$engine->include_module('tag.lyrics3');
$tag = new getid3_id3v1($engine);
$tag->Analyze();
$tag = new getid3_lyrics3($engine);
$tag->Analyze();
$apetag = $this->generate_tag();
if (!($fp = @fopen($this->filename, 'a+b'))) {
throw new getid3_exception('Could not open a+b: ' . $this->filename);
}
// init: audio ends at eof
$post_audio_offset = filesize($this->filename);
// lyrics3 tag present
if (@$engine->info['lyrics3']['tag_offset_start']) {
// audio ends before lyrics3 tag
$post_audio_offset = @$engine->info['lyrics3']['tag_offset_start'];
} elseif (@$engine->info['id3v1']['tag_offset_start']) {
// audio ends before id3v1 tag
$post_audio_offset = $engine->info['id3v1']['tag_offset_start'];
}
// seek to end of audio data
fseek($fp, $post_audio_offset, SEEK_SET);
// save data after audio data
$post_audio_data = '';
if (filesize($this->filename) > $post_audio_offset) {
$post_audio_data = fread($fp, filesize($this->filename) - $post_audio_offset);
}
// truncate file before start of new apetag
fseek($fp, $post_audio_offset, SEEK_SET);
ftruncate($fp, ftell($fp));
// write new apetag
fwrite($fp, $apetag, strlen($apetag));
// rewrite data after audio
if (!empty($post_audio_data)) {
fwrite($fp, $post_audio_data, strlen($post_audio_data));
}
fclose($fp);
clearstatcache();
return true;
}
示例2: read
public function read()
{
$engine = new getid3();
$engine->filename = $this->filename;
$engine->fp = fopen($this->filename, 'rb');
$engine->include_module('tag.id3v1');
$tag = new getid3_id3v1($engine);
$tag->Analyze();
if (!isset($engine->info['id3v1'])) {
return;
}
$this->title = $engine->info['id3v1']['title'];
$this->artist = $engine->info['id3v1']['artist'];
$this->album = $engine->info['id3v1']['album'];
$this->year = $engine->info['id3v1']['year'];
$this->genre_id = $engine->info['id3v1']['genre_id'];
$this->genre = $engine->info['id3v1']['genre'];
$this->comment = $engine->info['id3v1']['comment'];
$this->track = $engine->info['id3v1']['track'];
return true;
}