예제 #1
0
파일: index.php 프로젝트: BitingChaos/punch
     $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)) {
         $j->ping_job($job);
     }
     passthru_m3u8($_SERVER['PATH_TRANSLATED'], $source_file);
     break;
 case 'spawn':
     // spawn and register an encoder since caller asked for an m3u8 file that does not yet exist