You are here

public function video_s3::load_file in Video 6.4

Same name and namespace in other branches
  1. 6.5 plugins/video_s3/filesystem/video_s3.inc \video_s3::load_file()

Overrides filesystem_interface::load_file

File

plugins/video_s3/filesystem/video_s3.inc, line 17

Class

video_s3

Code

public function load_file($video) {
  module_load_include('lib.inc', 'video_s3');
  $s3 = new video_amazon_s3();
  if ($s3file = $s3
    ->get($video->fid)) {
    $s3
      ->connect();
    foreach ($video->files as $key => &$file) {
      $filepath = $file->filepath;

      // For old video's (pre-4.5), the filename property is actually a path
      // and no ffmpeg converted files were saved to S3.
      if (strpos('/', $file->filename) !== FALSE) {
        $filepath = $file->filename;
      }
      $file->url = $s3
        ->getVideoUrl($filepath, $s3file->bucket);
    }
  }
}