<?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', "коммент");
$dbh = new PDO($dsn, $user, $password);
//$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$dbh->query('select * from unknown_table');