From 8041073c8d74e5d24e3b9f10143f3e4bd04db2de Mon Sep 17 00:00:00 2001 From: Heshan Wanigasooriya Date: Tue, 23 Mar 2010 04:17:29 +0000 Subject: removing old files and commenting new file field and other files to the vidoe module page. --- plugins/video_ffmpeg_helper/video_scheduler.php | 115 ------------------------ 1 file changed, 115 deletions(-) delete mode 100644 plugins/video_ffmpeg_helper/video_scheduler.php (limited to 'plugins/video_ffmpeg_helper/video_scheduler.php') diff --git a/plugins/video_ffmpeg_helper/video_scheduler.php b/plugins/video_ffmpeg_helper/video_scheduler.php deleted file mode 100644 index 1ebbe02..0000000 --- a/plugins/video_ffmpeg_helper/video_scheduler.php +++ /dev/null @@ -1,115 +0,0 @@ - - * @author Heshan Wanigasooriya - * @todo - */ - - -/** - * video_scheduler.php configuration -*/ - -// number of conversion jobs active at the same time -define('VIDEO_RENDERING_FFMPEG_INSTANCES', 5); - -/** - * video_scheduler.php configuration ends. - * DO NOT EDIT BELOW THIS LINE -*/ - -/** - * Define some constants -*/ -define('VIDEO_RENDERING_PENDING', 1); -define('VIDEO_RENDERING_ACTIVE', 5); -define('VIDEO_RENDERING_COMPLETE', 10); -define('VIDEO_RENDERING_FAILED', 20); - -if (isset($_SERVER['argv'][1])) { - $url = parse_url($_SERVER['argv'][1]); - $_SERVER['SCRIPT_NAME'] = $url['path']; - $_SERVER['HTTP_HOST'] = $url['host']; -} - -include_once('./includes/bootstrap.inc'); -//module_load_include('/includes/bootstrap.inc', 'video_scheduler', 'includes/bootstrap'); -// disable error reporting for bootstrap process -error_reporting(E_ERROR); -// let's bootstrap: we will be able to use drupal apis -drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); -// enable full error reporting again -error_reporting(E_ALL); - - -// allow execution only from the command line! -if(empty($_SERVER['REQUEST_METHOD'])) { - video_scheduler_main(); -} -else { - print t('This script is only executable from the command line.'); - die(); -} - - - -/** - * Main for video_scheduler.php -*/ -function video_scheduler_main() { - - if($jobs = video_scheduler_select()) { - foreach ($jobs as $job) { - video_scheduler_start($job); - } - } - else { - watchdog('video_scheduler', 'no video conversion jobs to schedule.', array(), WATCHDOG_DEBUG); - } -} - - -/** - * Starts rendering for a job -*/ -function video_scheduler_start($job) { - $url = (isset($_SERVER['argv'][1])) ? escapeshellarg($_SERVER['argv'][1]) : ''; - exec("php video_render.php $job->nid $job->vid $url > /dev/null &"); -} - - -/** - * Select VIDEO_RENDERING_FFMPEG_INSTANCES jobs from the queue - * - * @return an array containing jobs -*/ -function video_scheduler_select() { - - $result = db_query('SELECT * FROM {video_rendering} vr INNER JOIN {node} n ON vr.vid = n.vid INNER JOIN {video} v ON n.vid = v.vid WHERE n.nid = v.nid AND vr.nid = n.nid AND vr.status = %d ORDER BY n.created', VIDEO_RENDERING_PENDING); - - // TODO: order jobs by priority - - // TODO: use db_query_range - $jobs = array(); - $i = 0; - $count = db_result(db_query('SELECT COUNT(*) FROM {video_rendering} vr INNER JOIN {node} n ON vr.vid = n.vid INNER JOIN {video} v ON n.vid = v.vid WHERE n.nid = v.nid AND vr.nid = n.nid AND vr.status = %d ORDER BY n.created', VIDEO_RENDERING_PENDING)); - while($i < $count && $i < VIDEO_RENDERING_FFMPEG_INSTANCES) { - $jobs[] = db_fetch_object($result); - $i++; - } -//print_r($jobs); - return $jobs; -} - - - - -?> -- cgit v1.2.3