Сообщество IT-специалистов
Ответы на любые вопросы об IT
Профессиональное развитие в IT
Удаленная работа для IT-специалистов
<?php class Mp3 { static function write_id3($file, $artist, $title, $genre, $album, $year, $track, $comment) { $TaggingFormat = 'UTF-8'; set_include_path(PATH.'/lib/getid3'); require_once('getid3.php'); // Initialize getID3 engine $getID3 = new getID3; $getID3->setOption(array('encoding'=>$TaggingFormat)); require_once('write.php'); // Initialize getID3 tag-writing module $tagwriter = new getid3_writetags; //$tagwriter->filename = '/path/to/file.mp3'; $tagwriter->filename = $file; $tagwriter->tagformats = array('id3v1', 'id3v2.4'); // set various options (optional) $tagwriter->overwrite_tags = true; $tagwriter->tag_encoding = $TaggingFormat; $tagwriter->remove_other_tags = true; // populate data array $TagData['title'][] = $title; $TagData['artist'][] = $artist; $TagData['album'][] = $album; $TagData['year'][] = (int)$year; $TagData['recording_time'][] = (int)$year; $TagData['genre'][] = $genre; $TagData['comment'][] = $comment; $TagData['track'][] = $track; $tagwriter->tag_data = $TagData; // write tags if ($tagwriter->WriteTags()) { //return true; echo 'Successfully wrote tags<br>'; if (!empty($tagwriter->warnings)) { echo 'There were some warnings:<br>'.implode('<br><br>', $tagwriter->warnings); } } else { //return false; echo 'Failed to write tags!<br>'.implode('<br><br>', $tagwriter->errors); } } } //Mp3::write_id3('d:/z.mp3', 'Аррр', 'Титл', 'рок', '', '2009', '7', "коммент");
<?php $data = array( "title" => "Re:Начало", "artist" => "Re:\Легион", "album" => "", "year" => "", "genre" => "", "comment" => "", "track" => "" ); $result = id3_set_tag(__DIR__ . '/124.mp3', $data, ID3_V1_1); if ($result === true) { echo "Tag succesfully updated\n"; } ?>