コード例 #1
0
ファイル: Reader.php プロジェクト: gravitymedia/metadata
 /**
  * Read metadata
  *
  * @throws \RuntimeException
  *
  * @return array
  */
 public function read()
 {
     $this->handler->Analyze();
     if (!empty($this->info['error'])) {
         GetId3::getInstance()->close();
         throw new \RuntimeException(sprintf('Error while reading metadata from "%s": %s.', $this->filename, implode(PHP_EOL, $this->info['error'])));
     }
     if (isset($this->info[$this->name])) {
         $data = $this->info[$this->name];
         if (in_array($this->name, array('audio', 'video'))) {
             $data['playtime'] = $this->info['playtime_seconds'];
         }
         return $data;
     }
     return array();
 }
 public function __construct(getID3 $getid3)
 {
     parent::__construct($getid3);
     // extends getid3_handler::__construct()
     // initialize all GUID constants
     $GUIDarray = $this->KnownGUIDs();
     foreach ($GUIDarray as $GUIDname => $hexstringvalue) {
         if (!defined($GUIDname)) {
             define($GUIDname, $this->GUIDtoBytestring($hexstringvalue));
         }
     }
 }
コード例 #3
0
 public function __construct(getID3 $getid3)
 {
     parent::__construct($getid3);
     if ((bool) ini_get('safe_mode')) {
         throw new getid3_exception('PHP running in Safe Mode - backtick operator not available, cannot analyze Shorten files.');
     }
     if (!`head --version`) {
         throw new getid3_exception('head[.exe] binary not found in path. UNIX: typically /usr/bin. Windows: typically c:\\windows\\system32.');
     }
     if (!`shorten -l`) {
         throw new getid3_exception('shorten[.exe] binary not found in path. UNIX: typically /usr/bin. Windows: typically c:\\windows\\system32.');
     }
 }
コード例 #4
0
 public function __construct(getID3 $getid3)
 {
     parent::__construct($getid3);
     // Populate bindec_cache
     for ($i = 0; $i < 256; $i++) {
         $this->decbin_cache[chr($i)] = str_pad(decbin($i), 8, '0', STR_PAD_LEFT);
     }
     // Init cache
     $this->bitrate_cache = array();
     // Fast scanning?
     if (!$getid3->option_accurate_results) {
         $this->option_max_frames_to_scan = 200;
         $getid3->warning('option_accurate_results set to false - bitrate and playing time are not accurate.');
     }
 }
コード例 #5
0
 public function AnalyzeString(&$string)
 {
     // Rewrite header_size in header
     $new_header_size = getid3_lib::LittleEndian2String(strlen($string), 4);
     for ($i = 0; $i < 4; $i++) {
         $string[$i + 4] = $new_header_size[$i];
     }
     return parent::AnalyzeString($string);
 }