예제 #1
0
             if (!isset($value) || $value == "") {
                 $display_key = @str_replace('_', " ", $key);
                 $message_type = $config['notification_error'];
                 $blk_id = 2;
                 $error_message = $error_message . ' - ' . $display_key . '  ' . $lang_required;
                 $procede = false;
             }
         }
     }
 }
 // end submitted
 // audio id3 tags
 if ($procede == true) {
     require 'includes/mp3_id3_utils.php';
     $mp3 = "uploads/audio/{$uploaded_file_name}";
     $id1 = mp3_id($mp3);
     if ($id1 == -1) {
         //echo "File not exists or invalid header.<br>";
     } else {
         reset($id1);
         while (list($key, $val) = each($id1)) {
             switch ($key) {
                 case 'title':
                     $title = $val;
                     break;
                 case 'artist':
                     $artist = $val;
                     break;
                 case 'lenght':
                     $length = $val;
                     break;
예제 #2
0
파일: Mp3.php 프로젝트: vojtajina/sitellite
 function set_id3($file, $id3tag)
 {
     $id3 = mp3_id($file);
     if (!is_array($id3)) {
         // If I couldn't open the file
         return false;
     }
     // quit with error.
     $fields = array("title", "artist", "album", "year", "comment", "track", "genreid");
     // Checks if the ID is present, if not, create an empty one.
     reset($fields);
     if (!$id3["tag"]) {
         while ($field = each($fields)) {
             $id3[$field["value"]] = "";
         }
     }
     // Update the ID3 TAG info with the new one
     reset($fields);
     while ($field = each($fields)) {
         if (isset($id3tag[$field["value"]])) {
             $id3[$field["value"]] = $id3tag[$field["value"]];
         }
     }
     // Make the TAG with this info.
     $tag = "TAG";
     $tag .= Mp3Parser::str_padtrunc($id3["title"], 30, chr(0));
     $tag .= Mp3Parser::str_padtrunc($id3["artist"], 30, chr(0));
     $tag .= Mp3Parser::str_padtrunc($id3["album"], 30, chr(0));
     $tag .= Mp3Parser::str_padtrunc($id3["year"], 4, chr(0));
     $tag .= Mp3Parser::str_padtrunc(str_padtrunc($id3["comment"], 28, chr(0)), 29, chr(0));
     $tag .= chr($id3["track"]);
     $tag .= chr($id3["genreid"]);
     // Try to open the file with read/write perms...
     if (!($f = @fopen($file, "r+"))) {
         return false;
     } else {
         $len = filesize($file);
         if (!$id3["tag"]) {
             // If TAG doesn't exist, put the pointer at the end of the file
             fseek($f, $len);
         } else {
             // If exists, put the pointer at the begining of the TAG.
             fseek($f, $len - 128);
         }
         echo "\n";
         // Saves the data
         if (fputs($f, $tag, 128) != 128) {
             // If doesn't writes 128 bytes...
             fclose($f);
             // Close File
             return false;
             // Return with error
         }
     }
     fclose($f);
     return true;
 }
예제 #3
0
}
echo "<br>Time to take the info: " . (time() - $start) . " seconds.<br>";
// author: sejba@geocities.com
// This was modified by Luca.
// Now we set a ID3 TAG
$id2["title"] = "Is a song";
$id2["comment"] = "The Comment";
$id2["track"] = 20;
// If you're using this in a web server, remember that the server proccess must have read/write perms in test.mp3!!!
if (set_id3("test.mp3", $id2)) {
    echo "OK!<br>";
} else {
    echo "There was an error!<br>";
}
$start = time();
$id3 = mp3_id("test.mp3");
if ($id3 == -1) {
    echo "File not exists or invalid header.<br>";
} else {
    reset($id3);
    echo "<Table border=1 celpadding=1 cellspacing=1>";
    while (list($key, $val) = each($id3)) {
        echo "<tr><td><font size=1 face=tahoma>{$key} </td><td><font size=1 face=tahoma>{$val}</td></tr>";
    }
    echo "</table>";
    if ($id3 == 0) {
        echo "File doesn't have an ID3 tag.";
    }
}
echo "<br>Time to take the info: " . (time() - $start) . " seconds.<br>";
// Returns test file to the original values.