You are here

function video_s3_video_insert in Video 6.4

Implementing hook_video_insert

Parameters

<type> $element:

<type> $form_state:

File

plugins/video_s3/video_s3.module, line 90
Provides wrapper functions for the s3 amazon webservices.

Code

function video_s3_video_insert(&$element, &$form_state) {
  if (!_video_s3_is_active_fs()) {
    return;
  }
  $file = $element['#value'];

  //we need to check if this fid has already been added to the database AND that there is in fact a fid
  if (is_array($file) && isset($file['fid']) && !empty($file['fid'])) {
    module_load_include('lib.inc', 'video_s3');
    $s3 = new video_amazon_s3();
    $s3
      ->connect();

    // Lets verify that we haven't added this video already.  Multiple validation fails will cause this to be ran more than once
    if (!($video = $s3
      ->verify($file['fid']))) {

      // Video has not been added to the queue yet so lets add it.
      $s3
        ->insert($file['fid']);
      drupal_set_message(t('Video submission queued for transfer to your Amazon S3 server. Will be there shortly.'));
    }
  }
}