Example #1
0
 function process($file)
 {
     $mp3 = new id3v2();
     $mp3->GetInfo($file);
     if (!is_array($mp3->id3v2Info)) {
         return false;
     }
     ob_start();
     print_r($mp3->id3v2Info);
     $out = ob_get_contents();
     ob_end_clean();
     return $out;
 }
Example #2
0
 function get_info($file)
 {
     require_once VIVVO_FS_ROOT . "lib/vivvo/framework/PEAR/MP3_Id/id3v2.php";
     $mp3 = new id3v2();
     $mp3->GetInfo($file);
     //$mp3->ShowInfo();
     $data = array();
     if (!empty($mp3->id3v1Info['title'])) {
         $data[] = 'Title: ' . $mp3->id3v1Info['title'];
     }
     if (!empty($mp3->id3v1Info['artist'])) {
         $data[] = 'Artist: ' . $mp3->id3v1Info['artist'];
     }
     if (!empty($mp3->id3v1Info['album'])) {
         $data[] = 'Album: ' . $mp3->id3v1Info['album'];
     }
     if (!empty($mp3->id3v1Info['year'])) {
         $data[] = 'Year: ' . $mp3->id3v1Info['year'];
     }
     if (!empty($mp3->id3v1Info['track'])) {
         $data[] = 'Track: #' . $mp3->id3v1Info['track'];
     }
     if (!empty($mp3->mpegInfo['PlayTime'])) {
         $data[] = 'Play time: ' . $mp3->mpegInfo['PlayTime'];
     }
     if (!empty($mp3->mpegInfo['Bitrate'])) {
         $data[] = 'Bitrate: ' . $mp3->mpegInfo['Bitrate'] . ' kbps';
     }
     if (!empty($mp3->mpegInfo['SamplingRate'])) {
         $data[] = 'Sampling rate: ' . round($mp3->mpegInfo['SamplingRate'] / 1000, 1) . ' KHz';
     }
     if ($data) {
         return implode("\n", $data);
     } else {
         return false;
     }
 }
Example #3
0
<?php

/* This code is released under the GNU LGPL. Go read it over here:
 *
 * http://www.gnu.org/copyleft/lesser.txt 
 */
include_once "id3v2.php";
if (!isset($file)) {
    $file = "";
}
$mp3 = new id3v2();
$ini = $mp3->myMicrotime();
if (is_dir($file)) {
    $mp3->myReaddir($file);
} else {
    $mp3->GetInfo($file);
    $mp3->ShowInfo();
}
$end = $mp3->myMicrotime();
$donetime = $end - $ini;
echo "<br>All done in " . $donetime . " seconds<br>";