You are here

function video_scheduler_select in Video 6

Same name and namespace in other branches
  1. 5 plugins/video_ffmpeg_helper/video_scheduler.php \video_scheduler_select()
  2. 6.2 plugins/video_ffmpeg_helper/video_scheduler.php \video_scheduler_select()
  3. 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 100
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_num_rows($result);
  while ($i < $count && $i < VIDEO_RENDERING_FFMPEG_INSTANCES) {
    $jobs[] = db_fetch_object($result);
    $i++;
  }
  return $jobs;
}