From f53f62a5ecf8343941e2c74d06b429bb271d7df2 Mon Sep 17 00:00:00 2001 From: Heshan Date: Sun, 13 Mar 2011 00:03:05 +0530 Subject: Completed some transcoding stuff and tested the video convert on save. --- includes/conversion.inc | 4 ---- includes/preset.inc | 11 +++++++---- includes/transcoder.inc | 23 +++++++---------------- 3 files changed, 14 insertions(+), 24 deletions(-) (limited to 'includes') diff --git a/includes/conversion.inc b/includes/conversion.inc index b9be2b4..6611e06 100644 --- a/includes/conversion.inc +++ b/includes/conversion.inc @@ -93,10 +93,6 @@ class video_conversion { return $this->transcoder->create_job($video, $nid); } - public function update_job($video) { - return $this->transcoder->update_job($video); - } - public function delete_job($video) { return $this->transcoder->delete_job($video); } diff --git a/includes/preset.inc b/includes/preset.inc index f1c14b8..d3a3fdd 100644 --- a/includes/preset.inc +++ b/includes/preset.inc @@ -36,7 +36,7 @@ class video_preset { } $preset = array(); foreach ($presets as $id => $value) { - $preset[$id] = $value['name'] . ' ' . l(t('edit'), ('admin/config/media/video/presets/preset/' . $value['name'])); + $preset[$value['name']] = $value['name'] . ' ' . l(t('edit'), ('admin/config/media/video/presets/preset/' . $value['name'])); // $help[] = $value['name'] . ' - ' . $value['description'] . ' ' . l(t('edit'), preset_get_preset_path('video', $value['name'])); } @@ -62,10 +62,13 @@ class video_preset { * @return array $properties */ public function properties() { + module_load_include('inc', 'video_ui', 'video.preset'); + $presets = array(); $preset = $this->preset; - return $options['properties']; - if (preset_exists('video', $preset)) - preset_get_settings($preset); + foreach ($preset as $preset_name) { + $presets[$preset_name] = video_get_preset($preset_name); + } + return $presets; } } \ No newline at end of file diff --git a/includes/transcoder.inc b/includes/transcoder.inc index 994ab47..e5f7123 100644 --- a/includes/transcoder.inc +++ b/includes/transcoder.inc @@ -89,22 +89,19 @@ class video_transcoder { } public function convert_video(&$video) { + // load the presets $video_preset = new video_preset(); $presets = $video_preset->properties(); $video->presets = $presets; $output = $this->transcoder->convert_video($video); // if successfully converted the video then update the status to publish - if ($output) + if ($output && variable_get('video_publish_on_complete', TRUE)) // Update our node id to published. We do not do a node_load as it causes editing problems when saving. - db_query("UPDATE {node} SET status=%d WHERE nid=%d", 1, $video->nid); - - // If they are using metadata. - // @TODO : add meta data support -// if (variable_get('video_metadata', FALSE)) { -// module_load_include('inc', 'video', '/includes/metadata'); -// $metadata = new video_metadata; -// $metadata->process($converted); -// } + db_update('node') + ->fields(array( + 'status' => NODE_PUBLISHED)) + ->condition('nid', $video->nid, '=') + ->execute(); return $output; } @@ -171,10 +168,6 @@ class video_transcoder { return $this->transcoder->create_job($video, $nid); } - public function update_job($video) { - return $this->transcoder->update_job($video); - } - public function delete_job($video) { return $this->transcoder->delete_job($video); } @@ -203,8 +196,6 @@ interface transcoder_interface { public function create_job($video, $nid); - public function update_job($video); - public function delete_job($video); public function load_job($fid); -- cgit v1.2.3