コード例 #1
0
     continue;
 }
 $filename = $adapterObject->filePathMetadata($media);
 if (!$filename) {
     $api->log(LOG_CRIT, "Got task '" . $task["id"] . "' but media '" . $task["mediaid"] . "' didn't allow to find the file using adapter '" . $task["adapter"] . "' !!");
     $api->setTaskFailedUnlock($task["id"]);
     continue;
 }
 if (!file_exists($filename) || filesize($filename) == 0) {
     $api->log(LOG_CRIT, "Got task '" . $task["id"] . "' but file '" . $filename . "' not found or has zero size!!");
     $api->setTaskFailedUnlock($task["id"]);
     continue;
 }
 // ok, now we use ffmpeg to get the metadata of the downloaded media
 // depending on FFMPEG / AVCONV version, we use one parser or the other ...
 $metadata = $ffmpeg->getFfmpegMetadata($filename);
 if ($metadata) {
     if (count($metadata["tracks"]) == 0) {
         // Store the metadata in the media object:
         $api->mediaUpdate($task["mediaid"], array("status" => MEDIA_METADATA_FAILED, "metadata" => serialize($metadata)));
         // Queue the task to tell the client that we had an error getting the metadata
         $api->queueAdd(TASK_SEND_METADATAERROR, $task["mediaid"], API_RETRY);
         // ok, transfer finished, let's mark it done
         $api->setTaskProcessedUnlock($task["id"]);
         $api->log(LOG_DEBUG, "Failed (properly) while processing task '" . $task["id"] . "', metadata for media '" . $task["mediaid"] . "'");
     } else {
         // Store the metadata in the media object:
         $api->mediaUpdate($task["mediaid"], array("status" => MEDIA_METADATA_OK, "metadata" => serialize($metadata)));
         // Queue the task to tell the client that we have the metadata
         $api->queueAdd(TASK_SEND_METADATA, $task["mediaid"], API_RETRY);
         // ok, transfer finished, let's mark it done
コード例 #2
0
#!/usr/bin/env php
<?php 
/** ************************************************************
 * Metadata maker process for a single file
 * Use this to test the metadata processor
 */
if (!isset($argv[1])) {
    echo "Usage: " . $argv[0] . " <filename> \n Shows metadata of <filename> from the ffmpeg parser\n";
    exit(127);
}
require_once __DIR__ . '/../../../common.php';
require_once __DIR__ . '/../libs/api.php';
require_once __DIR__ . '/../libs/ffmpeg.php';
$ffmpeg = new Ffmpeg();
$m = $ffmpeg->getFfmpegMetadata($argv[1]);
print_r($m);
コード例 #3
0
ファイル: test_metadata.php プロジェクト: ninetian/omk-server
#!/usr/bin/php
<?php 
// Configuration
require_once __DIR__ . '/common.php';
require_once MODULES . '/api/libs/ffmpeg.php';
require_once MODULES . '/api/libs/api.php';
$api = new api();
$ffmpeg = new Ffmpeg();
$ffmpeg->DEBUG = 1;
if (count($argv) < 2) {
    echo "USAGE: test_metadata.php <filename>\n";
    echo "tells the metadata of a file\n\n";
    exit;
}
print_r($ffmpeg->getFfmpegMetadata($argv[1]));