Api
Version
mediamosa-21Class
mediamosa_rest_call_job_create_stillCode
File: /sites/all/modules/mediamosa/modules/job/mediamosa_job.rest.inc
<?php
/**
* URI: /asset/$asset_id/still/create
*
* Method: POST
*
* Create a still job.
*
* 1.x: vpx_jobscheduler_create_new_still_job_2
*
*/
class mediamosa_rest_call_job_create_still extends mediamosa_rest_call_job_create {
// ------------------------------------------------------------------ Consts.
// The asset ID.
const ASSET_ID = 'asset_id';
// ------------------------------------------------------------------ Get Var Setup.
public function get_var_setup() {
$a_var_setup = parent::get_var_setup();
unset($a_var_setup[self::VARS][parent::JOB_TYPE]);
// Although its required, its not used(!).
// note: mediamosa_rest_call_job_create_still_for_mediafile() depends on
// this non-requirement and non-usage.
$a_var_setup[self::VARS][self::ASSET_ID] = array(
self::VAR_TYPE => mediamosa_type::TYPE_ASSET_ID,
self::VAR_DESCRIPTION => 'The asset ID of the medafile.',
self::VAR_IS_REQUIRED => self::VAR_IS_REQUIRED_YES,
);
return $a_var_setup;
}
// ------------------------------------------------------------------ Progress Rest Args.
/**
* Process the supplied parameters.
*
* @param array $a_var_setup
*/
protected function process_rest_args(array $a_var_setup) {
// Set job type and give it fixed value.
$a_var_setup[self::VARS][self::JOB_TYPE] = array(
self::VAR_TYPE => mediamosa_type::TYPE_JOB,
self::VAR_DESCRIPTION => 'The job type.',
self::VAR_IS_REQUIRED => self::VAR_IS_REQUIRED_YES,
self::VAR_OVERRIDE_VALUE => mediamosa_job_db::JOB_TYPE_STILL,
);
// GET / POST to array.
$a_var_setup = parent::process_rest_args($a_var_setup);
// Backward compatibility.
if ($this->isset_given_param(self::STILL_TYPE) || $this->get_param_value(self::STILL_TYPE) == 'NONE') {
$start_frame = $this->get_param_value(self::START_FRAME);
$end_frame = $this->get_param_value(self::END_FRAME);
$frametime = $this->get_param_value(self::FRAMETIME);
if (!$start_frame && $frametime) {
$this->set_param_value(self::START_FRAME, $frametime);
}
$size = $this->get_param_value(self::SIZE);
$width = $this->get_param_value(self::WIDTH);
$height = $this->get_param_value(self::HEIGHT);
if (!$start_frame) {
$start_frame = $this->set_param_value(self::START_TIME);
}
if (!$end_frame) {
$end_frame = $this->set_param_value(self::END_TIME);
}
if (empty($size) && $width && $height) {
$this->set_param_value(self::SIZE, $width . 'x' . $height);
}
}
unset($a_var_setup[self::VARS][parent::FRAMETIME]);
unset($a_var_setup[self::VARS][parent::WIDTH]);
unset($a_var_setup[self::VARS][parent::HEIGHT]);
return $a_var_setup;
}
// ------------------------------------------------------------------ Do Call.
public function do_call() {
parent::do_call();
}
}