| 1 |
<?php |
<?php |
| 2 |
//$Id$ |
//$Id: video_scheduler.php,v 1.5.2.1 2009/05/27 01:48:28 heshanmw Exp $ |
| 3 |
/** |
/** |
| 4 |
* @file |
* @file |
| 5 |
* Implement video rendering scheduling. |
* Implement video rendering scheduling. |
| 20 |
*/ |
*/ |
| 21 |
|
|
| 22 |
// set to the ffmpeg executable |
// set to the ffmpeg executable |
| 23 |
define('VIDEO_RENDERING_FFMPEG_PATH', '/usr/bin/ffmpeg'); |
define('VIDEO_RENDERING_FFMPEG_PATH', '/home2/heidisof/bin/./ffmpeg'); |
| 24 |
|
|
| 25 |
// set to the temp file path. |
// set to the temp file path. |
| 26 |
//IMPORTANT: the user who runs this script must have permissions to create files there. If this is not the case the default php temporary folder will be used. |
//IMPORTANT: the user who runs this script must have permissions to create files there. If this is not the case the default php temporary folder will be used. |
| 48 |
$_SERVER['HTTP_HOST'] = $url['host']; |
$_SERVER['HTTP_HOST'] = $url['host']; |
| 49 |
} |
} |
| 50 |
|
|
| 51 |
module_load_include('/includes/bootstrap.inc', 'video_scheduler', 'includes/bootstrap'); |
include_once('./includes/bootstrap.inc'); |
| 52 |
|
//module_load_include('/includes/bootstrap.inc', 'video_scheduler', 'includes/bootstrap'); |
| 53 |
// disable error reporting for bootstrap process |
// disable error reporting for bootstrap process |
| 54 |
error_reporting(E_ERROR); |
error_reporting(E_ERROR); |
| 55 |
// let's bootstrap: we will be able to use drupal apis |
// let's bootstrap: we will be able to use drupal apis |
| 108 |
// TODO: use db_query_range |
// TODO: use db_query_range |
| 109 |
$jobs = array(); |
$jobs = array(); |
| 110 |
$i = 0; |
$i = 0; |
| 111 |
$count = db_num_rows($result); |
$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)); |
| 112 |
while($i < $count && $i < VIDEO_RENDERING_FFMPEG_INSTANCES) { |
while($i < $count && $i < VIDEO_RENDERING_FFMPEG_INSTANCES) { |
| 113 |
$jobs[] = db_fetch_object($result); |
$jobs[] = db_fetch_object($result); |
| 114 |
$i++; |
$i++; |
| 115 |
} |
} |
| 116 |
|
//print_r($jobs); |
| 117 |
return $jobs; |
return $jobs; |
| 118 |
} |
} |
| 119 |
|
|