aboutsummaryrefslogtreecommitdiff
path: root/video.drush.inc
blob: 8c01f6dcd89b015c8f559493803ba2389ad080bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php

/**
 * Implementation of hook_drush_command().
 */
function video_drush_command() {
  $items = array();

  $items['video-scheduler'] = array(
    'description' => 'Run video transcoder scheduler',
    'callback' => 'drush_video_scheduler',
    'drupal dependencies' => array('video'),
    'options' => array(
      '--limit' => 'Change the number of video items to transcode',
    ),
  );

  return $items;
}

/**
 * Callback function
 */
function drush_video_scheduler() {
  $limit = (int) drush_get_option('limit', variable_get('video_ffmpeg_instances', 5));
  $GLOBALS['conf']['video_ffmpeg_instances'] = $limit;

  // include our conversion class (also contains our defines)
  module_load_include('inc', 'video', 'includes/conversion');
  $video_conversion = new video_conversion;
  $video_conversion->run_queue();
}