diff options
author | Heshan <heshan@heidisoft.com> | 2011-03-13 00:03:05 +0530 |
---|---|---|
committer | Heshan <heshan@heidisoft.com> | 2011-03-13 00:03:05 +0530 |
commit | f53f62a5ecf8343941e2c74d06b429bb271d7df2 (patch) | |
tree | 788ce5cb10e20aa104b2b9975a0b07304fef63b5 /video.field.inc | |
parent | d47e35b2a2c56ecbfc813433d96082394f98136b (diff) | |
download | video-f53f62a5ecf8343941e2c74d06b429bb271d7df2.tar.gz video-f53f62a5ecf8343941e2c74d06b429bb271d7df2.tar.bz2 |
Completed some transcoding stuff and tested the video convert on save.
Diffstat (limited to 'video.field.inc')
-rw-r--r-- | video.field.inc | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/video.field.inc b/video.field.inc index 0534efc..d81294c 100644 --- a/video.field.inc +++ b/video.field.inc @@ -137,11 +137,32 @@ function video_field_presave($entity_type, $entity, $field, $instance, $langcode function video_field_insert($entity_type, $entity, $field, $instance, $langcode, &$items) { file_field_insert($entity_type, $entity, $field, $instance, $langcode, $items); // Create entry for video conversion if auto converison is enabled -// if ($field['settings']['autoconversion'] == 1) { -// foreach ($items as $delta => $item) { -// video_convert_process($item); -// } -// } + if ($field['settings']['autoconversion'] == 1) { + $nid = $entity->vid; + module_load_include('inc', 'video', '/includes/conversion'); + $video_conversion = new video_conversion; + foreach ($items as $delta => $item) { + // skip adding entry if bypass conversion is checked + if ($item['bypass_autoconversion'] == 1 || variable_get('video_bypass_conversion', FALSE)) { + // delete the conversion job if any + $video_conversion->delete_job($item); + return; + } + // 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'); + } + // if convert on save is checked + if ($item['convert_video_on_save'] == 1 || variable_get('video_convert_on_save', FALSE)) { + if (!$video_conversion->process($item['fid'])) { + drupal_set_message(t('Something went wrong with your video conversion. Please check your recent log entries for further debugging.'), 'error'); + } else { + drupal_set_message(t('Successfully converted your video.')); + } + } + } + } } /** |