aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/transcoder.inc10
-rw-r--r--modules/video_ui/video.admin.inc4
-rw-r--r--transcoders/video_ffmpeg.inc13
-rw-r--r--video.field.inc20
-rw-r--r--video.module2
5 files changed, 38 insertions, 11 deletions
diff --git a/includes/transcoder.inc b/includes/transcoder.inc
index e9dfbda..30aa6ba 100644
--- a/includes/transcoder.inc
+++ b/includes/transcoder.inc
@@ -102,13 +102,19 @@ class video_transcoder {
$video->presets = $presets;
$output = $this->transcoder->convert_video($video);
// if successfully converted the video then update the status to publish
- 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.
+ 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_update('node')
->fields(array(
'status' => NODE_PUBLISHED))
->condition('nid', $video->nid, '=')
->execute();
+ db_update('node_revision')
+ ->fields(array(
+ 'status' => NODE_PUBLISHED))
+ ->condition('nid', $video->nid, '=')
+ ->execute();
+ }
return $output;
}
diff --git a/modules/video_ui/video.admin.inc b/modules/video_ui/video.admin.inc
index 11259e9..32fc5e8 100644
--- a/modules/video_ui/video.admin.inc
+++ b/modules/video_ui/video.admin.inc
@@ -80,8 +80,8 @@ function video_general_admin_settings() {
'#type' => 'checkbox',
'#title' => t('Publish when conversion complete'),
'#default_value' => variable_get('video_publish_on_complete', TRUE),
- '#description' => t('Initially un-publish till conversion complete and then
- publish the node only when conversion complete and successful.')
+ '#description' => t('Un-publish the node on submit and once conversion complete
+ turn node in to publish.')
);
return system_settings_form($form);
}
diff --git a/transcoders/video_ffmpeg.inc b/transcoders/video_ffmpeg.inc
index 98108de..224ea1f 100644
--- a/transcoders/video_ffmpeg.inc
+++ b/transcoders/video_ffmpeg.inc
@@ -30,6 +30,7 @@ class video_ffmpeg implements transcoder_interface {
}
public function run_command($command) {
+ // transcoder switching
$command = strtr($command, array(
'!ffmpeg' => $this->params['ffmpeg'],
'!ffmpeg2theora' => $this->params['ffmpeg2theora'],
@@ -39,11 +40,11 @@ class video_ffmpeg implements transcoder_interface {
));
$command = $this->nice . $command . ' 2>&1';
watchdog('transcoder', 'Executing command: ' . $command, array(), WATCHDOG_DEBUG);
- ob_start();
- passthru($command, $command_return);
- $output = ob_get_contents();
- ob_end_clean();
- return $output;
+// ob_start();
+ $command_return = shell_exec($command);
+// $output = ob_get_contents();
+// ob_end_clean();
+ return $command_return;
}
public function generate_thumbnails($video) {
@@ -326,7 +327,7 @@ class video_ffmpeg implements transcoder_interface {
'#type' => 'textfield',
'#title' => t('Mcoder'),
'#description' => t('Absolute path to Mcoder executable. This will provide a token of !macoder to preset commands.'),
- '#default_value' => variable_get('video_macoder_path', '/usr/bin/macoder'),
+ '#default_value' => variable_get('video_macoder_path', '/usr/bin/mcoder'),
);
$form['transcoders']['video_handbreke_path'] = array(
'#type' => 'textfield',
diff --git a/video.field.inc b/video.field.inc
index 700cf7e..21ea62f 100644
--- a/video.field.inc
+++ b/video.field.inc
@@ -165,6 +165,7 @@ function video_field_update($entity_type, $entity, $field, $instance, $langcode,
function _video_field_file_autoconversion($entity_type, $entity, $field, $instance, $langcode, &$items) {
// Create entry for video conversion if auto converison is enabled
if ($field['settings']['autoconversion'] == 1) {
+ $job = FALSE;
$nid = $entity->vid;
module_load_include('inc', 'video', '/includes/conversion');
$video_conversion = new video_conversion;
@@ -179,14 +180,19 @@ function _video_field_file_autoconversion($entity_type, $entity, $field, $instan
if (isset($item['re_convert_video']) && $item['re_convert_video'] == 1) {
$video = $video_conversion->load_job($item['fid']);
$video_conversion->change_status($video->vid, VIDEO_RENDERING_PENDING);
+ $job = TRUE;
}
// Lets verify that we haven't added this video already. Multiple validation fails will cause this to be ran more than once
if (!$video = $video_conversion->load_job($item['fid'])) {
if (!($video_conversion->create_job($item, $nid)))
drupal_set_message(t('Something went wrong with your video job creation. Please check your recent log entries for further debugging.'), 'error');
+ else
+ $job = TRUE;
}
// if convert on save is checked
if (isset($item['convert_video_on_save']) && $item['convert_video_on_save'] == 1 || variable_get('video_convert_on_save', FALSE)) {
+ // set to false when convert on save
+ $job = FALSE;
switch ($video_conversion->process($item['fid'])) {
case FALSE:
drupal_set_message(t('Something went wrong with your video conversion. Please check your recent log entries for further debugging.'), 'error');
@@ -197,6 +203,20 @@ function _video_field_file_autoconversion($entity_type, $entity, $field, $instan
}
}
}
+ // set node status to unpublish
+ if ($job && 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_update('node')
+ ->fields(array(
+ 'status' => NODE_NOT_PUBLISHED))
+ ->condition('nid', $nid, '=')
+ ->execute();
+ db_update('node_revision')
+ ->fields(array(
+ 'status' => NODE_NOT_PUBLISHED))
+ ->condition('nid', $nid, '=')
+ ->execute();
+ }
}
}
diff --git a/video.module b/video.module
index d7f180b..4f23168 100644
--- a/video.module
+++ b/video.module
@@ -701,4 +701,4 @@ function video_features_api() {
'file' => drupal_get_path('module', 'video') . '/video.features.inc',
),
);
-}
+} \ No newline at end of file