You are here

public static function video_jobs::loadQueue in Video 7.2

Select videos from our queue.

Up to 'video_ffmpeg_instances' videos are returned. The status of all returned videos is set to VIDEO_RENDERING_INQUEUE.

2 calls to video_jobs::loadQueue()
Transcoder::runQueue in includes/Transcoder.inc
Processes up to 'video_ffmpeg_instances' jobs in the current thread.
video_cron in ./video.module
Implements hook_cron().

File

includes/jobs.inc, line 70
Static class containing transcoding job related operations.

Class

video_jobs
@file Static class containing transcoding job related operations.

Code

public static function loadQueue() {
  $total_videos = variable_get('video_ffmpeg_instances', 5);
  $now = time();
  $videos = array();
  $result = db_query_range('SELECT vf.*, f.*, vf.status as video_status FROM {video_queue} vf LEFT JOIN {file_managed} f ON vf.fid = f.fid WHERE vf.status = :vstatus AND f.status = :fstatus ORDER BY f.timestamp', 0, $total_videos, array(
    ':vstatus' => VIDEO_RENDERING_PENDING,
    ':fstatus' => FILE_STATUS_PERMANENT,
  ));
  foreach ($result as $row) {
    $row->video_status = VIDEO_RENDERING_INQUEUE;
    $row->statusupdated = $now;
    $row->data = empty($row->data) ? NULL : unserialize($row->data);
    self::update($row);
    $videos[] = $row;
  }
  return $videos;
}