Beispiel #1
0
}
$j = new JobController($config['memcached']);
switch ($q) {
    case 'expire':
    case 'retire':
        // retire expire encoders - best to cron this as often as you are comfortable
        $threshold = isset($_REQUEST['threshold']) && !empty($_REQUEST['threshold']) ? $_REQUEST['threshold'] : MINIMUM_CRON_GRANULARITY;
        $jobs_killed = $j->expire_old_jobs_per_threshold($threshold);
        if (!empty($jobs_killed)) {
            echo "killed: " . implode(',', $jobs_killed);
        }
        break;
    case 'clean':
    case 'clear':
        // put down all encoders - start from ground zero
        $j->flush_all_jobs();
        break;
    case 'debug':
    case 'print':
        // reveal all jobs
        $format = isset($_REQUEST['format']) && !empty($_REQUEST['format']) ? $_REQUEST['format'] : DEFAULT_PRINT_FORMAT;
        $j->print_r_jobs($format);
        break;
    case 'ping':
        // touch the job associated with the passed source
        // the following seems to work with the mod_action handler for existing m3u8 files.  If the .htaccess file is rearchitected, this will need servicing too.
        $source_file = basename($_SERVER['REQUEST_URI']);
        // scrape all up to the final .m3u8, and ditch any parameters appended to the spec
        // WAS: $source_url = preg_replace('/(.*).m3u8(\?.*)$/i', '\1', urldecode($source_file));
        $source_url = preg_replace('/(.*)(.m3u8.*)$/i', '\\1', urldecode($source_file));
        if ($job = $j->job_of_source($source_url)) {