function video_scheduler_select in Video 6.2
Same name and namespace in other branches
- 5 plugins/video_ffmpeg_helper/video_scheduler.php \video_scheduler_select()
- 6 plugins/video_ffmpeg_helper/video_scheduler.php \video_scheduler_select()
- 6.3 video_scheduler.php \video_scheduler_select()
Select VIDEO_RENDERING_FFMPEG_INSTANCES jobs from the queue
Return value
an array containing jobs
1 call to video_scheduler_select()
- video_scheduler_main in plugins/
video_ffmpeg_helper/ video_scheduler.php - Main for video_scheduler.php
File
- plugins/
video_ffmpeg_helper/ video_scheduler.php, line 93 - Implement video rendering scheduling. If you are not using sites/default/settings.php as your settings file, add an optional parameter for the drupal site url: "php video_scheduler.php http://example.com/" or "php video_scheduler.php…
Code
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', VIDEO_RENDERING_PENDING));
while ($i < $count && $i < VIDEO_RENDERING_FFMPEG_INSTANCES) {
$jobs[] = db_fetch_object($result);
$i++;
}
//print_r($jobs);
return $jobs;
}