public function video_zencoder::load_completed_job in Video 6.4
Same name and namespace in other branches
- 6.5 plugins/video_zencoder/transcoders/video_zencoder.inc \video_zencoder::load_completed_job()
- 7 modules/video_zencoder/transcoders/video_zencoder.inc \video_zencoder::load_completed_job()
@todo : replace with the load job method
Parameters
<type> $video:
Return value
<type>
Overrides transcoder_interface::load_completed_job
File
- plugins/
video_zencoder/ transcoders/ video_zencoder.inc, line 326
Class
Code
public function load_completed_job(&$video) {
$video_row = db_fetch_object(db_query('SELECT data FROM {video_zencoder} WHERE fid = %d', $video->fid));
$data = unserialize($video_row->data);
if (empty($data)) {
return $video;
}
foreach ($data as $value) {
$path = parse_url($value->url, PHP_URL_PATH);
$extension = pathinfo($path, PATHINFO_EXTENSION);
$video->files->{$extension} = new stdClass();
$video->files->{$extension}->filename = pathinfo($path, PATHINFO_FILENAME) . '.' . $extension;
$video->files->{$extension}->filepath = substr($path, 1);
// Remove the leading slash
$video->files->{$extension}->url = $value->url;
// Authentication tokens are added by video_s3->load()
$video->files->{$extension}->extension = $extension;
$video->files->{$extension}->filemime = file_get_mimetype($value->url);
$video->player = strtolower($extension);
}
return $video;
}