| 1 |
<?php |
<?php |
| 2 |
//$Id$ |
//$Id: video_render.php,v 1.8.2.1 2009/05/27 01:48:28 heshanmw Exp $ |
| 3 |
/** |
/** |
| 4 |
* @file |
* @file |
| 5 |
* Renders a video. This script is called concurrently by video_scheduler.php |
* Renders a video. This script is called concurrently by video_scheduler.php |
| 19 |
/** |
/** |
| 20 |
* video_scheduler.php configuration |
* video_scheduler.php configuration |
| 21 |
*/ |
*/ |
|
|
|
| 22 |
// set to the ffmpeg executable |
// set to the ffmpeg executable |
| 23 |
define('VIDEO_RENDERING_FFMPEG_PATH', '/usr/bin/ffmpeg'); |
define('VIDEO_RENDERING_FFMPEG_PATH', '/home2/heidisof/bin/./ffmpeg'); |
| 24 |
|
|
| 25 |
// set to the temp file path. |
// set to the temp file path. |
| 26 |
//IMPORTANT: the user who runs this script must have permissions to create files there. If this is not the case the default php temporary folder will be used. |
//IMPORTANT: the user who runs this script must have permissions to create files there. If this is not the case the default php temporary folder will be used. |
| 52 |
$_SERVER['HTTP_HOST'] = $url['host']; |
$_SERVER['HTTP_HOST'] = $url['host']; |
| 53 |
} |
} |
| 54 |
|
|
| 55 |
module_load_include('/includes/bootstrap.inc', 'video_render', 'includes/bootstrap'); |
include_once('./includes/bootstrap.inc'); |
| 56 |
|
//module_load_include('/includes/bootstrap.inc', 'video_render', 'includes/bootstrap'); |
| 57 |
// disable error reporting for bootstrap process |
// disable error reporting for bootstrap process |
| 58 |
error_reporting(E_ERROR); |
error_reporting(E_ERROR); |
| 59 |
// let's bootstrap: we will be able to use drupal apis |
// let's bootstrap: we will be able to use drupal apis |
| 89 |
_video_render_job_change_status($nid, $vid, VIDEO_RENDERING_ACTIVE); |
_video_render_job_change_status($nid, $vid, VIDEO_RENDERING_ACTIVE); |
| 90 |
// load the job object |
// load the job object |
| 91 |
$job = _video_render_load_job($nid, $vid, VIDEO_RENDERING_ACTIVE); |
$job = _video_render_load_job($nid, $vid, VIDEO_RENDERING_ACTIVE); |
| 92 |
|
|
| 93 |
if($job == NULL) { |
if($job == NULL) { |
| 94 |
watchdog('video_render', 'video_render.php has been called with an invalid job resource. exiting.'); |
watchdog('video_render', 'video_render.php has been called with an invalid job resource. exiting.'); |
| 95 |
die; |
die; |
| 130 |
$dest_dir = dirname($job->origfile) . '/'; |
$dest_dir = dirname($job->origfile) . '/'; |
| 131 |
|
|
| 132 |
if (file_copy($file, $dest_dir)) { |
if (file_copy($file, $dest_dir)) { |
| 133 |
$file->fid = db_next_id('{files}_fid'); |
//$file->fid = db_next_id('{files}_fid'); |
| 134 |
//print_r($file); |
//print_r($file); |
| 135 |
db_query("INSERT INTO {files} (fid, nid, filename, filepath, filemime, filesize) VALUES (%d, %d, '%s', '%s', '%s', %d)", $file->fid, $job->nid, $file->filename, $file->filepath, $file->filemime, $file->filesize); |
db_query("INSERT INTO {files} (fid, uid, filename, filepath, filemime, filesize) VALUES (%d, %d, '%s', '%s', '%s', %d)", $file->fid, $job->uid, $file->filename, $file->filepath, $file->filemime, $file->filesize); |
| 136 |
|
|
| 137 |
|
// to know other modules of fid |
| 138 |
|
$file->fid = db_last_insert_id('files', 'fid'); |
| 139 |
|
|
| 140 |
db_query("INSERT INTO {upload} (fid, vid, list, description) VALUES (%d, %d, %d, '%s')", $file->fid, $job->vid, $file->list, $file->description); |
db_query("INSERT INTO {video_upload} (vid, nid, fid) VALUES (%d, %d, %d)", $job->vid, $job->vid, $file->fid); |
| 141 |
|
|
| 142 |
// update the video table |
// update the video table |
| 143 |
db_query('UPDATE {video} SET vidfile = "%s", videox = %d, videoy = %d WHERE nid=%d AND vid=%d', "", $job->calculatedx, $job->calculatedy, $job->nid, $job->vid); |
db_query('UPDATE {video} SET vidfile = "%s", videox = %d, videoy = %d WHERE nid=%d AND vid=%d', "", $job->calculatedx, $job->calculatedy, $job->nid, $job->vid); |