Пример #1
0
            if ($task) {
                $api->setTaskFailedUnlock($task["id"]);
            }
            exit;
            break;
    }
}
pcntl_signal(SIGTERM, "sig_handler");
pcntl_signal(SIGHUP, "sig_handler");
pcntl_signal(SIGINT, "sig_handler");
pcntl_signal(SIGQUIT, "sig_handler");
while (true) {
    // Cleanup daemons from this host
    $api->cleanupQueueLocks();
    // Search for a task
    $task = $api->getQueuedTaskLock(array(TASK_SEND_METADATA, TASK_SEND_TRANSCODE, TASK_SEND_METADATAERROR));
    if (!$task) {
        // we sleep for a little while, thanks to that, we can launch that process as soon as we want:
        // it will still do *nothing* for a little while when there is nothing to do ;)
        $api->log(LOG_DEBUG, "Nothing to do, sleeping...");
        sleep(60);
        continue;
    }
    $media = $api->mediaSearch(array("id" => $task["mediaid"]));
    if (!$media) {
        $api->log(LOG_CRIT, "Got task '" . $task["id"] . "' but media '" . $task["mediaid"] . "' not found!!");
        $api->setTaskFailedUnlock($task["id"]);
        continue;
    }
    $media = $media[0];
    $api->me = Users::get($task["user"]);
Пример #2
0
            if ($task) {
                $api->setTaskFailedUnlock($task["id"]);
            }
            exit;
            break;
    }
}
pcntl_signal(SIGTERM, "sig_handler");
pcntl_signal(SIGHUP, "sig_handler");
pcntl_signal(SIGINT, "sig_handler");
pcntl_signal(SIGQUIT, "sig_handler");
while (true) {
    // Cleanup daemons from this host
    $api->cleanupQueueLocks();
    // Search for a task
    $task = $api->getQueuedTaskLock(TASK_DOWNLOAD, "http");
    if (!$task) {
        // we sleep for a little while, thanks to that, we can launch that process as soon as we want:
        // it will still do *nothing* for a little while when there is nothing to do ;)
        $api->log(LOG_DEBUG, "Nothing to do, sleeping...");
        sleep(60);
        continue;
    }
    $media = $api->mediaSearch(array("id" => $task["mediaid"]));
    if (!$media) {
        $api->log(LOG_CRIT, "got task '" . $task["id"] . "' but media '" . $task["mediaid"] . "' not found");
        $api->setTaskFailedUnlock($task["id"]);
        continue;
    }
    $media = $media[0];
    $api->me = Users::get($task["user"]);
Пример #3
0
            }
            exit;
            break;
    }
    echo "oups";
}
pcntl_signal(SIGTERM, "sig_handler");
pcntl_signal(SIGHUP, "sig_handler");
pcntl_signal(SIGINT, "sig_handler");
pcntl_signal(SIGQUIT, "sig_handler");
$all_settings = $api->getAllSettings();
while (true) {
    // Cleanup daemons from this host
    $api->cleanupQueueLocks();
    // Search for a task
    $task = $api->getQueuedTaskLock(TASK_DO_TRANSCODE);
    if (!$task) {
        // we sleep for a little while, thanks to that, we can launch that process as soon as we want:
        // it will still do *nothing* for a little while when there is nothing to do ;)
        $api->log(LOG_DEBUG, "Nothing to do, sleeping...");
        sleep(60);
        continue;
    }
    // Get the task's parameters */
    $params = $task["params"];
    $media = $api->mediaSearch(array("id" => $task["mediaid"]));
    if (!$media) {
        $api->log(LOG_CRIT, "Got task '" . $task["id"] . "' but media '" . $task["mediaid"] . "' not found!!");
        $api->setTaskFailedUnlock($task["id"]);
        continue;
    }
Пример #4
0
                $api->setTaskFailedUnlock($task["id"]);
            }
            exit;
            break;
    }
    echo "oups";
}
pcntl_signal(SIGTERM, "sig_handler");
pcntl_signal(SIGHUP, "sig_handler");
pcntl_signal(SIGINT, "sig_handler");
pcntl_signal(SIGQUIT, "sig_handler");
while (true) {
    // Cleanup daemons from this host
    $api->cleanupQueueLocks();
    // Search for a task
    $task = $api->getQueuedTaskLock(TASK_DO_METADATA);
    if (!$task) {
        // we sleep for a little while, thanks to that, we can launch that process as soon as we want:
        // it will still do *nothing* for a little while when there is nothing to do ;)
        $api->log(LOG_DEBUG, "Nothing to do, sleeping...");
        sleep(60);
        continue;
    }
    // Get the task's parameters */
    $params = unserialize($task["params"]);
    $media = $api->mediaSearch(array("id" => $task["mediaid"]));
    if (!$media) {
        $api->log(LOG_CRIT, "Got task '" . $task["id"] . "' but media '" . $task["mediaid"] . "' not found!!");
        $api->setTaskFailedUnlock($task["id"]);
        continue;
    }
Пример #5
0
 * or wait 10 seconds if no download is queued.
 */
if (!function_exists("curl_init")) {
    error_log("php-curl not installed or not enabled, exit.\n");
    exit(1);
}
require_once __DIR__ . '/../../common.php';
require_once MODULES . '/api/libs/api.php';
$useragent = "OpenMediaKit-Transcoder/" . OMKT_VERSION . " (Download Daemon)";
$api = new Api();
$api->log_caller = "dummy-download-daemon";
while (true) {
    // Cleanup daemons from this host
    $api->cleanupQueueLocks();
    // Search for a task
    $task = $api->getQueuedTaskLock(TASK_DOWNLOAD, "dummy");
    if (!$task) {
        // we sleep for a little while, thanks to that, we can launch that process as soon as we want:
        // it will still do *nothing* for a little while when there is nothing to do ;)
        $api->log(LOG_DEBUG, "Nothing to do, sleeping...");
        sleep(60);
        continue;
    }
    $media = $api->mediaSearch(array("id" => $task["mediaid"]));
    if (!$media) {
        $api->log(LOG_CRIT, "got task '" . $task["id"] . "' but media '" . $task["mediaid"] . "' not found");
        $api->setTaskFailedUnlock($task["id"]);
        continue;
    }
    $media = $media[0];
    // ok, we try to download the file, with curl, with timeout and range management