本文整理匯總了PHP中getid3_lib::CopyTagsToComments方法的典型用法代碼示例。如果您正苦於以下問題:PHP getid3_lib::CopyTagsToComments方法的具體用法?PHP getid3_lib::CopyTagsToComments怎麽用?PHP getid3_lib::CopyTagsToComments使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類getid3_lib
的用法示例。
在下文中一共展示了getid3_lib::CopyTagsToComments方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: add
function add($item)
{
global $config;
if ($item['url']) {
// this is a remote file
if ($config['httpStreaming']) {
$lines = file($item['url']);
foreach ($lines as $line) {
if (!empty($line)) {
$this->audioFiles[] = array('url' => $line);
}
}
} else {
// nothing to do
// not tested for Tamburine
}
} else {
// this is a local file
// CHANGED BY BUDDHAFLY 06-02-20
if (!in_array(sotf_File::getExtension($item['path']), $config['skipGetID3FileTypes'])) {
$getID3 = new getID3();
$mp3info = $getID3->analyze($item['path']);
getid3_lib::CopyTagsToComments($mp3info);
} else {
$fileinfo['video'] = true;
}
//$mp3info = GetAllFileInfo($item['path']);
//debug('mp3info', $mp3info);
// CHANGED BY BUDDHAFLY 06-02-20
$bitrate = (string) $mp3info['bitrate'];
if (!$bitrate) {
raiseError("Could not determine bitrate, maybe this audio is temporarily unavailable");
}
$item['bitrate'] = $bitrate;
if ($config['httpStreaming']) {
//$tmpFileName = 'au_' . $item['id'] . '_' . ($item['name'] ? $item['name'] : basename($item['path']));
$tmpFileName = 'au_' . $item['id'] . '_' . basename($item['path']);
$tmpFile = $config['tmpDir'] . "/{$tmpFileName}";
$file = @readlink($tmpFile);
if ($file) {
if (!is_readable($file)) {
logError("Bad symlink: {$tmpFile} to {$file}");
unlink($tmpFile);
$file = false;
}
}
if (!$file) {
if (!symlink($item['path'], $tmpFile)) {
raiseError("symlink failed in tmp dir");
}
}
$item['url'] = $config['tmpUrl'] . "/{$tmpFileName}";
}
$this->totalLength += $mp3info["playtime_seconds"];
$this->audioFiles[] = $item;
}
}
示例2: extractDataFromFilename
protected function extractDataFromFilename($filename)
{
if (empty($filename)) {
return null;
}
$id3 = new getID3();
$data = $id3->analyze($filename);
getid3_lib::CopyTagsToComments($data);
return $data;
}
示例3: extract
/**
* get metadata info for a media file
*
* @param $path
* @return array
*/
public function extract($path)
{
if (ini_get('allow_url_fopen')) {
$file = \OC\Files\Filesystem::getView()->getAbsolutePath($path);
$data = @$this->getID3->analyze('oc://' . $file);
} else {
// Fallback to the local FS
$file = \OC\Files\Filesystem::getLocalFile($path);
}
\getid3_lib::CopyTagsToComments($data);
return $data;
}
示例4: sotf_AudioFile
/**
* Sets up sotf_AudioFile object
*
* @constructor sotf_AudioFile
* @param string $path Path of the file
*/
function sotf_AudioFile($path)
{
$parent = get_parent_class($this);
parent::$parent($path);
// Call the constructor of the parent class. lk. super()
// CHANGED BY BUDDHAFLY 06-05-12
$getID3 = new getID3();
$fileinfo = $getID3->analyze($this->path);
getid3_lib::CopyTagsToComments($fileinfo);
//$fileinfo = GetAllFileInfo($this->path);
$this->allInfo = $fileInfo;
//if ($audioinfo["fileformat"] == 'mp3' || $audioinfo["fileformat"] == 'ogg') {
//debug("finfo", $fileinfo);
if (isset($fileinfo['audio'])) {
$audioinfo = $fileinfo['audio'];
$this->type = "audio";
$this->format = $fileinfo["fileformat"];
if ($audioinfo["bitrate_mode"] == 'vbr') {
$this->bitrate = "VBR";
}
$this->bitrate = round($audioinfo["bitrate"] / 1000);
$this->average_bitrate = round($audioinfo["bitrate"] / 1000);
$this->samplerate = $audioinfo["sample_rate"];
$this->channels = $audioinfo["channels"];
$this->duration = round($fileinfo["playtime_seconds"]);
$this->mimetype = $this->determineMimeType($this->format);
}
}
示例5: getId3Data
/**
*
*
* @return array
*/
public function getId3Data() : array
{
$reader = new \getID3();
$info = $reader->analyze($this->path);
\getid3_lib::CopyTagsToComments($info);
return $info;
}
示例6: import_show
function import_show($showid, $dir, $type)
{
// Initialize getID3 engine
$getID3 = new getID3();
// Read files and directories
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
$full_name = $dir . "/" . $file;
if (is_file($full_name) || $file[0] != '.') {
$ThisFileInfo = $getID3->analyze($full_name);
if ($ThisFileInfo['fileformat'] == "mp3") {
getid3_lib::CopyTagsToComments($ThisFileInfo);
$album = mysql_real_escape_string(@implode(@$ThisFileInfo['comments_html']['album']));
$play_time = mysql_real_escape_string(@$ThisFileInfo['playtime_seconds']);
$title_name = mysql_real_escape_string(@implode(@$ThisFileInfo['comments_html']['title']));
$artist_name = mysql_real_escape_string(@implode(@$ThisFileInfo['comments_html']['artist']));
$full_name = mysql_real_escape_string($full_name);
if ($id = song_non_existant($full_name, $showid)) {
$artist_id = check_or_insert_artist($artist_name);
insert_into_tunes($title_name, $artist_id, $full_name, $album, $play_time, $showid, -1, $type);
} else {
$artist_id = check_or_insert_artist($artist_name);
update_tunes($title_name, $id, $artist_id, $full_name, $album, $play_time);
}
}
}
}
closedir($dh);
}
}
}
示例7: getId3
/**
* Get ID3 Details
*
* @param string $path
*
* @return array
*/
protected function getId3($path)
{
$getID3 = new \getID3();
$analyze = $getID3->analyze($path);
\getid3_lib::CopyTagsToComments($analyze);
return $analyze;
}
示例8: readMetadata
public static function readMetadata($file)
{
require_once __DIR__ . '/../vendor/autoload.php';
$getID3 = new \getID3();
$meta = $getID3->analyze($file);
\getid3_lib::CopyTagsToComments($meta);
return $meta;
}
示例9: getID3
public function getID3()
{
require_once PHPWS_SOURCE_DIR . 'lib/vendor/autoload.php';
$getID3 = new getID3();
// File to get info from
$file_location = $this->getPath();
// Get information from the file
$fileinfo = $getID3->analyze($file_location);
getid3_lib::CopyTagsToComments($fileinfo);
return $fileinfo;
}
示例10: getImageData
public function getImageData($filename, $callback)
{
global $getID3;
// Get sound meta
try {
$id3 = $getID3->analyze($filename);
getid3_lib::CopyTagsToComments($id3);
} catch (Exception $e) {
$callback(json_encode((object) array('result' => 'error', 'file' => $filename, 'error' => $e->getMessage())), '');
return;
}
if (isset($id3['comments']['picture'][0])) {
$callback(base64_encode($id3['comments']['picture'][0]['data']), $id3['comments']['picture'][0]['image_mime']);
} else {
$callback('', '');
}
}
示例11: Info
/**
* Extract information - only public function
*
* @access public
* @param string file Audio file to extract info from.
*/
function Info($file)
{
// Analyze file
$this->info = $this->getID3->analyze($file);
// Exit here on error
if (isset($this->info['error'])) {
return array('error' => $this->info['error']);
} else {
getid3_lib::CopyTagsToComments($this->info);
}
// Init wrapper object
$this->result = array();
$this->result['format_name'] = (isset($this->info['fileformat']) ? $this->info['fileformat'] : '') . '/' . (isset($this->info['audio']['dataformat']) ? $this->info['audio']['dataformat'] : '') . (isset($this->info['video']['dataformat']) ? '/' . $this->info['video']['dataformat'] : '');
$this->result['encoder_version'] = isset($this->info['audio']['encoder']) ? $this->info['audio']['encoder'] : '';
$this->result['encoder_options'] = isset($this->info['audio']['encoder_options']) ? $this->info['audio']['encoder_options'] : '';
$this->result['bitrate_mode'] = isset($this->info['audio']['bitrate_mode']) ? $this->info['audio']['bitrate_mode'] : '';
$this->result['channels'] = isset($this->info['audio']['channels']) ? $this->info['audio']['channels'] : '';
$this->result['sample_rate'] = isset($this->info['audio']['sample_rate']) ? $this->info['audio']['sample_rate'] : '';
$this->result['bits_per_sample'] = isset($this->info['audio']['bits_per_sample']) ? $this->info['audio']['bits_per_sample'] : '';
$this->result['playing_time'] = isset($this->info['playtime_seconds']) ? $this->info['playtime_seconds'] : '';
$this->result['playtime_string'] = isset($this->info['playtime_string']) ? $this->info['playtime_string'] : '';
$this->result['avg_bit_rate'] = isset($this->info['audio']['bitrate']) ? $this->info['audio']['bitrate'] : '';
$this->result['tags'] = isset($this->info['tags']) ? $this->info['tags'] : '';
$this->result['comments'] = isset($this->info['comments']) ? $this->info['comments'] : '';
$this->result['warning'] = isset($this->info['warning']) ? $this->info['warning'] : '';
$this->result['md5'] = isset($this->info['md5_data']) ? $this->info['md5_data'] : '';
// Post getID3() data handling based on file format
$method = (isset($this->info['fileformat']) ? $this->info['fileformat'] : '') . 'Info';
if ($method && method_exists($this, $method)) {
$this->{$method}();
}
return $this->result;
}
示例12: readFileDirectory
function readFileDirectory($path)
{
global $mysql, $getID3, $albumSongs;
foreach (scandir($path) as $currentFile) {
if ($currentFile == "." || $currentFile == "..") {
continue;
}
$fullPath = $path . "/" . $currentFile;
if (is_dir($fullPath)) {
readFileDirectory($fullPath);
} else {
$fileExtension = pathinfo($currentFile, PATHINFO_EXTENSION);
if ($fileExtension == "mp3" || $fileExtension == "wav" || $fileExtension == "ogg") {
$songInfo = $getID3->analyze($fullPath);
getid3_lib::CopyTagsToComments($songInfo);
if (!$songInfo['comments_html']['title'][0]) {
$songInfo['comments_html']['title'][0] = basename($currentFile);
}
if ($songInfo['tags']['id3v2']['album'][0]) {
$albumSongs[escape($songInfo['tags']['id3v2']['album'][0])] = true;
} else {
$albumSongs[escape($songInfo['comments_html']['artist'][0])] = true;
}
$mysql->query("INSERT INTO `songs` (`path`, `title`, `artist`, `album`, `length`) VALUES ('{$fullPath}', '" . escape($songInfo['comments_html']['title'][0]) . "', '" . escape($songInfo['comments_html']['artist'][0]) . "', '" . escape($songInfo['tags']['id3v2']['album'][0]) . "', '" . escape($songInfo['playtime_string']) . "')");
}
}
}
}
示例13: parseSoundFile
public static function parseSoundFile($filename)
{
global $getID3;
// Get sound meta
$id3 = $getID3->analyze($filename);
getid3_lib::CopyTagsToComments($id3);
// Validate
if (!Sounds::validateID3($id3)) {
unlink($filename);
return false;
}
// Make our directory
$artist = @$id3['comments']['artist'][0];
$album = @$id3['comments']['album'][0];
$dir = DOC_ROOT . '/music/' . Sounds::safeDirectory($artist) . '/' . Sounds::safeDirectory($album);
if (!is_dir($dir)) {
mkdir($dir, 0777, true);
}
// Our new filename
$moved = $dir . '/' . basename($filename);
// Already exists! Madness!
if (file_exists($moved)) {
unlink($filename);
return false;
}
// Move
rename($filename, $moved);
// Create and Save
$sound = new Sound(array('filename' => $moved));
$sound->save();
return $sound;
}
示例14: getid3
/**
* Get the ID3v2.x tag from an mp3 file.
*
* @param string $file
* @return array
* @access public
*/
function getid3($file)
{
global $mosConfig_absolute_path, $database;
require_once $mosConfig_absolute_path . "/components/com_zoom/lib/getid3/getid3.php";
require_once $mosConfig_absolute_path . "/components/com_zoom/lib/getid3/extension.cache.mysql.php";
$getid3 = new getID3_cached_mysql($database);
$fileInfo = $getid3->analyze($file);
getid3_lib::CopyTagsToComments($fileInfo);
return $fileInfo;
}
示例15: init
public function init()
{
global $getID3;
if (file_exists($this->filename) && !isset($this->_id3)) {
$this->_id3 = $getID3->analyze($this->filename);
getid3_lib::CopyTagsToComments($this->_id3);
$this->_url = WEB_ROOT . str_replace(array(DOC_ROOT, '\\'), array('', '/'), $this->filename);
$this->_imageUrl = isset($this->_id3['comments']['picture'][0]) ? WEB_ROOT . '/image/' . $this->id : '';
}
}