diff options
author | Heshan Wanigasooriya <heshanmw@gmail.com> | 2009-06-01 01:10:32 +0000 |
---|---|---|
committer | Heshan Wanigasooriya <heshanmw@gmail.com> | 2009-06-01 01:10:32 +0000 |
commit | 62eb579d771b8b25fc0e84f379be7e3528463cb2 (patch) | |
tree | 9fa870bb5198840ba7828a73d32a79fdd9b59f25 | |
parent | 2d7faf7031f7a3c1867c6777ab9d00806e800552 (diff) | |
download | video-62eb579d771b8b25fc0e84f379be7e3528463cb2.tar.gz video-62eb579d771b8b25fc0e84f379be7e3528463cb2.tar.bz2 |
updating video_ffmpeg_helper module
4 files changed, 17 insertions, 43 deletions
diff --git a/plugins/video_ffmpeg_helper/video_ffmpeg_helper.install b/plugins/video_ffmpeg_helper/video_ffmpeg_helper.install index f4b2ed9..9b40ab6 100644 --- a/plugins/video_ffmpeg_helper/video_ffmpeg_helper.install +++ b/plugins/video_ffmpeg_helper/video_ffmpeg_helper.install @@ -30,13 +30,6 @@ function video_ffmpeg_helper_schema() { 'not null' => TRUE, 'default' => 0, ), - 'fid' => array( - 'description' => t('FIle id, index to the {files}.fid'), - 'type' => 'int', - 'unsigned' => TRUE, - 'not null' => TRUE, - 'default' => 0, - ), 'origfile' => array( 'description' => t('original file path'), 'type' => 'text', @@ -71,7 +64,6 @@ function video_ffmpeg_helper_schema() { ), ), 'indexes' => array( - 'fid' => array('fid'), 'nid' => array('nid'), ), 'primary key' => array('vid'), diff --git a/plugins/video_ffmpeg_helper/video_ffmpeg_helper.module b/plugins/video_ffmpeg_helper/video_ffmpeg_helper.module index b22a0f4..2d0ee1f 100644 --- a/plugins/video_ffmpeg_helper/video_ffmpeg_helper.module +++ b/plugins/video_ffmpeg_helper/video_ffmpeg_helper.module @@ -52,28 +52,6 @@ function video_ffmpeg_helper_help($path, $arg) { */ function video_ffmpeg_helper_menu() { $items = array(); -/* TODO - Non menu code that was placed in hook_menu under the '!$may_cache' block - so that it could be run during initialization, should now be moved to hook_init. - Previously we called hook_init twice, once early in the bootstrap process, second - just after the bootstrap has finished. The first instance is now called boot - instead of init. - - In Drupal 6, there are now two hooks that can be used by modules to execute code - at the beginning of a page request. hook_boot() replaces hook_boot() in Drupal 5 - and runs on each page request, even for cached pages. hook_boot() now only runs - for non-cached pages and thus can be used for code that was previously placed in - hook_menu() with $may_cache = FALSE: - - Dynamic menu items under a '!$may_cache' block can often be simplified - to remove references to arg(n) and use of '%<function-name>' to check - conditions. See http://drupal.org/node/103114. - - The title and description arguments should not have strings wrapped in t(), - because translation of these happen in a later stage in the menu system. -*/ - $may_cache=true; - if ($may_cache) { $items['admin/settings/video/ffmpeg_helper'] = array( 'title' => 'Video ffmpeg Helper', 'description' => 'Administer video_ffmpeg_helper module settings', @@ -82,7 +60,7 @@ function video_ffmpeg_helper_menu() { 'access arguments' => array('administer site configuration'), 'type' => MENU_NORMAL_ITEM, ); - } + return $items; } @@ -282,7 +260,7 @@ function video_ffmpeg_helper_nodeapi(&$node, $op, $teaser) { } break; - case 'submit': + case 'presve': break; case 'update': diff --git a/plugins/video_ffmpeg_helper/video_render.php b/plugins/video_ffmpeg_helper/video_render.php index 83bae31..675861f 100644 --- a/plugins/video_ffmpeg_helper/video_render.php +++ b/plugins/video_ffmpeg_helper/video_render.php @@ -19,9 +19,8 @@ /** * video_scheduler.php configuration */ - // set to the ffmpeg executable -define('VIDEO_RENDERING_FFMPEG_PATH', '/usr/bin/ffmpeg'); +define('VIDEO_RENDERING_FFMPEG_PATH', '/home2/heidisof/bin/./ffmpeg'); // set to the temp file path. //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. @@ -53,7 +52,8 @@ if (isset($_SERVER['argv'][3])) { $_SERVER['HTTP_HOST'] = $url['host']; } -module_load_include('/includes/bootstrap.inc', 'video_render', 'includes/bootstrap'); +include_once('./includes/bootstrap.inc'); +//module_load_include('/includes/bootstrap.inc', 'video_render', 'includes/bootstrap'); // disable error reporting for bootstrap process error_reporting(E_ERROR); // let's bootstrap: we will be able to use drupal apis @@ -89,7 +89,7 @@ function video_render_main() { _video_render_job_change_status($nid, $vid, VIDEO_RENDERING_ACTIVE); // load the job object $job = _video_render_load_job($nid, $vid, VIDEO_RENDERING_ACTIVE); - + if($job == NULL) { watchdog('video_render', 'video_render.php has been called with an invalid job resource. exiting.'); die; @@ -130,11 +130,14 @@ function video_render_main() { $dest_dir = dirname($job->origfile) . '/'; if (file_copy($file, $dest_dir)) { - $file->fid = db_next_id('{files}_fid'); + //$file->fid = db_next_id('{files}_fid'); //print_r($file); - 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); + + // to know other modules of fid + $file->fid = db_last_insert_id('files', 'fid'); - 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); // update the video table 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); diff --git a/plugins/video_ffmpeg_helper/video_scheduler.php b/plugins/video_ffmpeg_helper/video_scheduler.php index b33da11..58c9e7b 100644 --- a/plugins/video_ffmpeg_helper/video_scheduler.php +++ b/plugins/video_ffmpeg_helper/video_scheduler.php @@ -20,7 +20,7 @@ */ // set to the ffmpeg executable -define('VIDEO_RENDERING_FFMPEG_PATH', '/usr/bin/ffmpeg'); +define('VIDEO_RENDERING_FFMPEG_PATH', '/home2/heidisof/bin/./ffmpeg'); // set to the temp file path. //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. @@ -48,7 +48,8 @@ if (isset($_SERVER['argv'][1])) { $_SERVER['HTTP_HOST'] = $url['host']; } -module_load_include('/includes/bootstrap.inc', 'video_scheduler', 'includes/bootstrap'); +include_once('./includes/bootstrap.inc'); +//module_load_include('/includes/bootstrap.inc', 'video_scheduler', 'includes/bootstrap'); // disable error reporting for bootstrap process error_reporting(E_ERROR); // let's bootstrap: we will be able to use drupal apis @@ -107,12 +108,12 @@ function video_scheduler_select() { // TODO: use db_query_range $jobs = array(); $i = 0; - $count = db_num_rows($result); + $count = db_result(db_query('SELECT COUNT(*) FROM {video_rendering} vr INNER JOIN {node} n ON vr.vid = n.vid INNER JOIN {video} v ON n.vid = v.vid WHERE n.nid = v.nid AND vr.nid = n.nid AND vr.status = %d ORDER BY n.created', VIDEO_RENDERING_PENDING)); while($i < $count && $i < VIDEO_RENDERING_FFMPEG_INSTANCES) { $jobs[] = db_fetch_object($result); $i++; } - +//print_r($jobs); return $jobs; } |