[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/video/metadata/ -> flvtool2.inc (source)

   1  <?php
   2  
   3  /*
   4   * @file
   5   * Class file used to store metadata on the video.
   6   *
   7   */
   8  class flvtool2 extends video_metadata {
   9  
  10    protected $params = array();
  11    protected $nice = 'nice -n 19';
  12    protected $meta_command = '-UP';
  13    protected $meta_command_path = '/usr/bin/flvtool2';
  14    protected $name = 'FlvTool2';
  15    protected $value = 'flvtool2';
  16  
  17    public function __construct() {
  18      $this->params['cmd_path'] = variable_get('video_metadata_path', $this->meta_command_path);
  19    }
  20  
  21    /**
  22     * Interface Implementations
  23     * @see sites/all/modules/video/includes/metadata_interface#get_name()
  24     */
  25    public function get_name() {
  26      return $this->name;
  27    }
  28  
  29    /**
  30     * Interface Implementations
  31     * @see sites/all/modules/video/includes/metadata_interface#get_help()
  32     */
  33    public function get_help() {
  34      return t('!flvtools calculates various meta data and inserts a onMetaData tag in the video. It cuts FLV files and adds cue Points (onCuePoint). A debug command shows the inside of a FLV file and the print command gives meta data information in XML or YAML format.', array('!flvtools' => l(t('FlvTools2 '), 'http://github.com/unnu/flvtool2')));
  35    }
  36  
  37    /**
  38     * Interface Implementations
  39     * @see sites/all/modules/video/includes/metadata_interface#get_value()
  40     */
  41    public function get_value() {
  42      return $this->value;
  43    }
  44  
  45    public function run_command($options) {
  46      $command = $this->nice . ' ' . $this->params['cmd_path'] . ' ' . $options . '  2>&1';
  47      watchdog('video_metadata', 'Executing command: ' . $command, array(), WATCHDOG_DEBUG);
  48      ob_start();
  49      passthru($command, $command_return);
  50      $output = ob_get_contents();
  51      ob_end_clean();
  52      return $output;
  53    }
  54  
  55    public function process($video) {
  56      $command_output = $this->run_command($this->meta_command . ' ' . $video);
  57      return $command_output;
  58    }
  59  
  60    public function admin_settings() {
  61      $form = array();
  62      $form['video_flvtool2_start'] = array(
  63        '#type' => 'markup',
  64        '#value' => '<div id="video_flvtool2">',
  65      );
  66      $form['video_metadata_path'] = array(
  67        '#type' => 'textfield',
  68        '#title' => t('Path to FLVTool2'),
  69        '#description' => t('Executable path to flvtool2.'),
  70        '#default_value' => variable_get('video_metadata_path', $this->meta_command_path),
  71      );
  72      $form['video_flvtool2_end'] = array(
  73        '#type' => 'markup',
  74        '#value' => '</div>',
  75      );
  76      return $form;
  77    }
  78  
  79    public function  admin_settings_validate($form, $form_state) {
  80      return;
  81    }
  82  
  83  }
  84  
  85  ?>


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7