? .video.module.swp
? patches
Index: video.module
===================================================================
--- video.module.orig	2007-05-24 07:45:52.000000000 -0700
+++ video.module	2007-05-24 07:46:08.000000000 -0700
@@ -109,7 +109,7 @@
           $menu_type = MENU_LOCAL_TASK;
         } 
         else {
-          $menu_type = MENU_CALLBACK;	     	
+          $menu_type = MENU_CALLBACK;
         }
         $items[] = array('path' => 'node/'. arg(1) .'/play',
           'title' => t('play'),
@@ -199,7 +199,7 @@
           );
         
       }
-	}
+    }
     if ($display_download_link == 1) {
       $link['video_download'] = array(
         'title' => t('download'),
@@ -626,7 +626,7 @@
     //If file is on the local server get size, otherwise get size from function.
     $path = getcwd() . '/' . $node->vidfile; //Local path to video file.
     $path_for_size = $path; // file_check_file will make $path unusable for filesize()
-    if (file_check_path($path) && is_file($path_for_size)) { //If file exists locally set size.
+    if (is_file($path_for_size) && file_check_path($path)) { //If file exists locally set size.
       $node->size = filesize($path_for_size);
     }
     else {
@@ -660,13 +660,11 @@
     if (isset($node->videoy) && $node->videoy <= 0) {
       form_set_error('videoy', t('You have to insert a valid vertical pixel size for this video'));
     }
+    //Make sure file size is valid.
+    if ((!isset($node->size) || !is_numeric($node->size) || $node->size < 0) && !isset($node->video_fid)) { //If the file is not local or not a valid number then set error.
+      form_set_error('size', t('You have to insert a valid file size for this video.'));
+    }
   }
-  //Make sure file size is valid.
-  $path = getcwd() . '/' . $node->vidfile; //Local path to video file.
-  if ((!isset($node->size) || !is_numeric($node->size) || $node->size < 0) && !$_SESSION['video_upload_file']) { //If the file is not local or not a valid number then set error. $_SESSION check needed for video_upload functionality
-    form_set_error('size', t('You have to insert a valid file size for this video.'));
-  }
-  
   //Makes sure the total playtime is greater than 0.
   $time = $node->playtime_seconds + $node->playtime_minutes + $node->playtime_hours;
   if ((isset($node->playtime_minutes) and isset($node->playtime_hours) and isset($node->playtime_seconds)) and $time == 0) {
@@ -713,19 +711,19 @@
   // if we are viewing the page, run the body through the theme
   if ($page) {
     $output = '';
-	if (variable_get('video_playinbody', 0)) {
-	  if (user_access('play video')) {
+    if (variable_get('video_playinbody', 0)) {
+      if (user_access('play video')) {
         $output .= theme('video_player', $node);
       }
-	  else {
-	    $output .= l(t('login'), "user/login", array('class' => 'outgoing', 'title' => t('login to your account')));
+      else {
+        $output .= l(t('login'), "user/login", array('class' => 'outgoing', 'title' => t('login to your account')));
         $output .= ' ' . t('or') . ' ';
         $output .= l(t('register'), "user/register", array('class' => 'outgoing', 'title' => t('create a new account')));
         $output .= t(' to play video');
       }
-	}
+    }
     $output .= theme('video_view', $node, $teaser, $page);
-	$node->content['body'] = array('#value' => $output);
+    $node->content['body'] = array('#value' => $output);
   }
 
   return $node;
@@ -882,7 +880,7 @@
 function video_play() {
   if ($node = node_load(arg(1))) {
     drupal_set_title(t('Playing') . ' ' . theme('placeholder', $node->title));
-	$output = theme('video_player', $node);
+    $output = theme('video_player', $node);
     if($output == ''){
       drupal_goto("node/$node->nid");
     }
@@ -1127,12 +1125,12 @@
   $output = '<!-- [if IE] -->
 <object classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616" width="'.$node->videox.'" height="'.$height.'" codebase="http://go.divx.com/plugin/DivXBrowserPlugin.cab">
 <!--> <![endif]-->'. "\n";
-	// this will be executed by not Internet Explorer browsers
+  // this will be executed by not Internet Explorer browsers
   $output = '<!-- [if !IE] --> 
 <object type="video/divx" data="'.$url.'" width="'.$node->videox.'" height="'.$height.'" mode="zero"> 
 <!--> <![endif]-->'."\n";
-  	
- 	$output .= '<param name="src" value="'.$url.'"/>'."\n";
+
+  $output .= '<param name="src" value="'.$url.'"/>'."\n";
   $output .= '<param name="mode" value="zero"/>'."\n";
   $output .= '</object>';
   $output = _theme_video_format_play($output,t('http://www.divx.com/divx/webplayer/'),
Index: plugins/video_ffmpeg_helper/video_ffmpeg_helper.module
===================================================================
--- plugins/video_ffmpeg_helper/video_ffmpeg_helper.module.orig	2007-05-24 07:45:52.000000000 -0700
+++ plugins/video_ffmpeg_helper/video_ffmpeg_helper.module	2007-05-24 07:45:59.000000000 -0700
@@ -61,10 +61,10 @@
     if (!is_numeric($form_values['video_ffmpeg_helper_auto_thumbnail_seek'])) {
       form_set_error('video_ffmpeg_helper_auto_thumbnail_seek', t('Seek time must be an integer'));
     }
-	$options = $form_values['video_ffmpeg_helper_thumbnailer_options'];
-	if (!strstr($options, '%videofile') || !strstr($options, '%thumbfile')) {
-	  form_set_error('video_ffmpeg_helper_thumbnailer_options', t('Thumbnail options must contain mandatory arguments %videofile and %thumbfile'));
-	}
+    $options = $form_values['video_ffmpeg_helper_thumbnailer_options'];
+    if (!strstr($options, '%videofile') || !strstr($options, '%thumbfile')) {
+      form_set_error('video_ffmpeg_helper_thumbnailer_options', t('Thumbnail options must contain mandatory arguments %videofile and %thumbfile'));
+    }
   }
 }
 
@@ -282,7 +282,8 @@
  * Add a video conversion rendering process to the queue
 */
 function _video_ffmpeg_helper_add_rendering(&$node) {
-  $file = $_SESSION['video_upload_file_stored']->filepath;
+  $file = _video_upload_fetch_file($node->video_fid);
+  $file = $file->filepath;
   //print_r($node); die;
   db_query('INSERT INTO {video_rendering} (vid, nid, origfile, pid, status, started, completed) VALUES (%d, %d, "%s", %d, %d, %d, %d)', $node->vid, $node->nid, $file, 0, VIDEO_RENDERING_PENDING, 0, 0);
   
@@ -300,12 +301,11 @@
 function _video_ffmpeg_helper_get_video_info(&$node) {
 
   // escape file name for safety
-  $file = escapeshellarg($_SESSION['video_upload_file']->filepath);
+  $file = _video_upload_fetch_file($node->video_fid);
+  $file = escapeshellarg($file->filepath);
   // create the full command to execute
   $command = variable_get('video_ffmpeg_helper_ffmpeg_path', '/usr/bin/ffmpeg') . ' -i ' . $file;
   
-  drupal_set_message('executing' . $command);
-  
   //execute the command
   ob_start();
   passthru($command." 2>&1", $command_return);
@@ -361,18 +361,20 @@
  *   a drupal file object
  */
 function _video_ffmpeg_helper_auto_thumbnail(&$node) {
-  if(empty($_SESSION['video_upload_file']) ||
-      !$_SESSION['video_upload_file']->newfile ||
-      $node->iid || $_SESSION['video_upload_file']->iid ||
-      $_SESSION['video_upload_file']->thumbnailed) {
-    if (variable_get('video_image_auto_thumbnail_debug', false)) {
-      if (empty($_SESSION['video_upload_file']))
+  $debug = variable_get('video_ffmpeg_helper_auto_thumbnail_debug', false);
+  if(empty($node->video_upload_file->filepath) ||
+      $node->thumbnailed || !$node->new_vidfile) {
+    if ($debug) {
+      if (empty($node->video_upload_file->filepath))
         drupal_set_message(t('no video has been uploaded: make sure that video_image weight is greater than video_upload weight; make sure that the video file is not too large to be uploaded.'));
+      else if ($node->thumbnailed)
+        drupal_set_message(t('not thumbnailing: video has already been thumbnailed'));
+      else if (!$node->new_vidfile)
+        drupal_set_message(t('not thumbnailing: video file was not newly uploaded'));
     }
     return null;
   }
-  $debug = variable_get('video_image_auto_thumbnail_debug', false);
-  $videofile = escapeshellarg($_SESSION['video_upload_file']->filepath);
+  $videofile = escapeshellarg($node->video_upload_file->filepath);
   $thumbfile = tempnam(file_directory_temp(), 'tnail-thumb');
   $seek = variable_get('video_image_auto_thumbnail_seek', 2);
   $tnail = variable_get('video_ffmpeg_helper_ffmpeg_path', '/usr/bin/ffmpeg');
@@ -392,13 +394,13 @@
     drupal_set_message(t('video_image_auto_thumbnail: file %file does not exist', array('%file' => $thumbfile)), 'error');
   }
   $file = array(
-      'filename' => $_SESSION['video_upload_file']->filename . ".video-thumb.jpg",
+      'filename' => basename($node->video_upload_file->filepath) . ".video-thumb.jpg",
       'filemime' => 'image/jpeg',
       'filesize' => filesize($thumbfile),
       'filepath' => $thumbfile,
       'nid' => $node->nid,
       );
-  $_SESSION['video_upload_file']->thumbnailed = TRUE;
+  $node->thumbnailed = true;
   if ($debug) {
     if ($tnail_return) {
       drupal_set_message(t('Failed to thumbnail video'));
Index: plugins/video_image/video_image.module
===================================================================
--- plugins/video_image/video_image.module.orig	2007-05-24 07:45:52.000000000 -0700
+++ plugins/video_image/video_image.module	2007-05-24 07:45:59.000000000 -0700
@@ -43,12 +43,6 @@
  * Settings form
  */
 function video_image_admin_settings() {
-  if (module_exists('video_upload')) {
-    if (variable_get('video_image_auto_thumbnail', 0)) {
-      $upload_weight = db_result(db_query("SELECT weight FROM {system} WHERE name='video_upload'"));
-      db_query("UPDATE {system} SET weight=".($upload_weight+1)." WHERE name='video_image'");
-    }
-  }
   $form = array();
   $form['video_image_publish_thumbnail'] = array(
       '#type' => 'checkbox',
@@ -72,6 +66,8 @@
 
   if($form_id == 'video_node_form') {
 
+    _video_image_check_settings();
+
     $node = $form['#node'];
     $value = ($node->new_image) ? '#value' : '#default_value';
     $form['iid'] = array('#type' => 'hidden', $value => $node->iid);
@@ -100,50 +96,51 @@
       case 'load': 
         $output['iid'] = $node->serial_data['iid'];
         return $output;
-      case 'submit':
-        if (variable_get('video_image_auto_thumbnail_debug', false) && variable_get('video_image_auto_thumbnail', false)) {
-          drupal_set_message(t('video_image_nodeapi: prepare: ready to thumbnail image'));
-        }
-        $field_name = file_check_upload('image');
-        $image->uid = $node->uid;
-        $image->name = $node->name;
-        $image->created = $node->created;
-        $image->type = 'image';
-        //$image->status = _video_image_publish_thumbnails();
-        //$image->promote = _video_image_promote_thumbnails();
-        if (!$field_name && module_exists('video_ffmpeg_helper') && variable_get('video_ffmpeg_helper_auto_thumbnail', false)) {
-          $image->title = $_SESSION['video_upload_file']->filename;
-          $field_name = _video_ffmpeg_helper_auto_thumbnail($node);
-        }
-        else {
-          $image->title = $_POST['edit']['image_title'];
-          $field_name = 'image';
-        }
-        image_prepare($image, $field_name);
-        if ($image->images) {
-          node_validate($image);
-          if (!form_get_errors()) {
-            $image = node_submit($image);
-            node_save($image);
-            
-            // needed to set the correct status and promote values if the user does not have enought permissions. Is there a better solution???
-            db_query('UPDATE {node} SET status = %d, promote = %d WHERE nid = %d AND vid = %d', _video_image_publish_thumbnails(), _video_image_promote_thumbnails(), $image->nid, $image->vid); 
-            
-            $node->iid = $node->serial_data['iid'] = $image->nid;
-            $_SESSION['video_upload_file']->iid = $image->nid;
-            $node->new_image = TRUE;
-          }
-        }
-        else if (isset($_SESSION['video_upload_file']->iid)) {
-          $node->iid = $_SESSION['video_upload_file']->iid;
-        }
-      
-        $node->serial_data['iid'] = $node->iid;
-      break;
       case 'prepare':
-        ;
+	  	if ((variable_get('video_ffmpeg_helper_auto_thumbnail', false) && $node->new_vidfile)
+		    || $field_name = file_check_upload('image')) {
+			if (variable_get('video_ffmpeg_helper_auto_thumbnail_debug', false) && variable_get('video_ffmpeg_helper_auto_thumbnail', false)) {
+			  drupal_set_message(t('video_image_nodeapi: prepare: ready to thumbnail video'));
+			}
+			if ($node->iid) {
+				node_delete($node->iid);
+			}
+			$vidfile = $node->video_upload_file;
+			$image->uid = $node->uid;
+			$image->name = $node->name;
+			$image->created = $node->created;
+			$image->type = 'image';
+			//$image->status = _video_image_publish_thumbnails();
+			//$image->promote = _video_image_promote_thumbnails();
+			if (!$field_name && module_exists('video_ffmpeg_helper') && variable_get('video_ffmpeg_helper_auto_thumbnail', false)) {
+			  $image->title = t('Video thumbnail for !title', array('!title' => $node->title));
+			  $field_name = _video_ffmpeg_helper_auto_thumbnail($node);
+			}
+			else {
+			  $image->title = $_POST['edit']['image_title'];
+			  $field_name = 'image';
+			}
+			image_prepare($image, $field_name);
+			if ($image->images) {
+			  node_validate($image);
+			  if (!form_get_errors()) {
+				$image = node_submit($image);
+				node_save($image);
+
+				// needed to set the correct status and promote values if the user does not have enought permissions. Is there a better solution???
+				db_query('UPDATE {node} SET status = %d, promote = %d WHERE nid = %d AND vid = %d', _video_image_publish_thumbnails(), _video_image_promote_thumbnails(), $image->nid, $image->vid);
+
+				$node->iid = $image->nid;
+				$node->new_image = TRUE;
+			  }
+			}
+		}
       break;
 
+	  case 'submit':
+		  $node->serial_data['iid'] = $node->iid;
+		  break;
+
       case 'view':
         if ($node->iid) {
           if($teaser) {
@@ -155,7 +152,9 @@
         }
         break;
       case 'delete':
+	  	$messages = drupal_get_messages();
         node_delete(array('nid' => $node->iid));
+		$_SESSION['messages'] = $messages;
         break;
     }
   }
@@ -238,4 +237,17 @@
   }
   return $settings_override;
 }
+
+/* The video_image module requires to have a heavier weight than the video_upload
+ * module (if it is enabled).  Otherwise the video will never get thumbnailed.
+ * We check for that at video_form time so we know it will work for the following
+ * video creation.
+ */
+function _video_image_check_settings() {
+  if (module_exists('video_upload') &&
+     variable_get('video_ffmpeg_helper_auto_thumbnail', 0)) {
+    $upload_weight = db_result(db_query("SELECT weight FROM {system} WHERE name='video_upload'"));
+    db_query("UPDATE {system} SET weight=".($upload_weight+1)." WHERE name='video_image'");
+  }
+}
 ?>
Index: plugins/video_upload/video_upload.module
===================================================================
--- plugins/video_upload/video_upload.module.orig	2007-05-24 07:45:52.000000000 -0700
+++ plugins/video_upload/video_upload.module	2007-05-24 07:55:13.000000000 -0700
@@ -1,5 +1,6 @@
 <?php
 // $Id: video_upload.module,v 1.16 2007/01/14 17:30:40 fax8 Exp $
+/* ex: set tabstop=2 expandtab shiftwidth=2 softtabstop=2: */
 
 /**
  * @file
@@ -71,25 +72,33 @@
   return array('upload video files');
 }
 
+/**
+ * Implementation of hook_cron()
+ */
+function video_upload_cron() {
+  /* look for crusty files */
+  $temppath = file_directory_temp() . '/video/';
+  $files = file_scan_directory(file_create_path($temppath), '.*');
+  foreach ($files as $file => $info) {
+    if (time() - filemtime($file) > 60*60*6) {
+      db_query("DELETE FROM {files} WHERE nid = 1 AND filepath = '%s'", $file);
+      file_delete($file);
+    }
+  }
+}
 
 /**
  * Implementation of hook_nodeapi()
  */
-function video_upload_nodeapi(&$node, $op, $teaser) {
+function video_upload_nodeapi(&$node, $op, $arg=null) {
   if($node->type == 'video') {
     switch ($op) {
   
       case 'load':
-        $output['video_upload_file'] = _video_upload_load($node);
-        if($node->vidfile == '') { // we will disable uploaded file if a path is already live
-          $output['vidfile'] = file_create_url($output['video_upload_file']->filepath);
-          // set the filesize - this seems not to work.. why???
-          $output['size'] = $output['video_upload_file']->filesize;
-        }
-        return $output;
+        return _video_upload_load($node);
       
       case 'prepare':
-        _video_upload_prepare($node);
+        _video_upload_prepare($node, $arg);
         break;
   
       case 'validate':
@@ -105,10 +114,7 @@
         _video_upload_store($node);
         break;
       case 'update':
-        // is there a better way ???
-        $node->video_upload_file = _video_upload_load($node);
-        _video_upload_delete($node);
-        _video_upload_store($node);
+        _video_upload_update($node);
         break;
   
       case 'delete':
@@ -169,7 +175,7 @@
 }
 
 
-function _video_upload_load(&$node) {
+function _video_upload_load_file(&$node) {
   if ($node->vid) {
     $result = db_query('SELECT * FROM {files} f INNER JOIN {file_revisions} r ON f.fid = r.fid WHERE r.vid = %d ORDER BY f.fid DESC', $node->vid);
     //while($item =  db_fetch_object($result)) {
@@ -184,61 +190,63 @@
  * Validate video file
  */
 function _video_upload_validate(&$node) {
-  // if we override the default video module vidfile field and we don't have a file uploaded set error
-  if (user_access('upload video files') && variable_get('video_upload_override_vidfile', false) && !isset($node->video_upload_file) && !isset($_SESSION['video_upload_file'])) {
-    form_set_error('video_upload_file', t('A file must be provided.'));
-    return;
-  }
 }
 
 
 function _video_upload_submit(&$node) {
-  ;
+  $video_upload_file = _video_upload_load_file($node);
+  if ($video_upload_file && $node->video_fid != $video_upload_file->fid) {
+    $node->vidfile = file_create_url($video_upload_file->filepath);
+  }
+  $node->serial_data['video_fid'] = $node->video_fid;
 }
 
-
-function _video_upload_prepare(&$node) {
-  // clear video file informations
-  if(count($_POST) == 0) {
-    if (!empty($_SESSION['video_upload_file'])) {
-      file_delete($_SESSION['video_upload_file']->filepath);
-    }
-    unset($_SESSION['video_upload_file']);
+function _video_upload_load(&$node) {
+  $output = array();
+  $file = _video_upload_load_file($node);
+  $output['video_upload_file'] = $file;
+  if ($file->fid && $node->serial_data['video_fid'] &&
+      $file->fid != $node->serial_data['video_fid']) {
+    $output['video_fid'] = $file->fid;
+  }
+  else {
+    $output['video_fid'] = $node->serial_data['video_fid'];
+  }
+  if ($node->vidfile == '') { // we will disable uploaded file if a path is already live
+    $node->vidfile = file_create_url($file->filepath);
+    // set the filesize - this seems not to work.. why???
+    $node->size = $file->filesize;
   }
+  return $output;
+}
 
-
-  if ($file = file_check_upload('video_upload_file')) {
+function _video_upload_prepare(&$node, $field_name=null) {
+  if (is_null($field_name)) {
+    $field_name = 'video_upload_file';
+  }
+  if ($file = file_check_upload($field_name)) {
     $temppath = file_directory_temp() . '/video/';
     file_check_directory($temppath, TRUE);
-    $node->video_upload_file = file_save_upload($file, $temppath .'/'. $file->filename, FILE_EXISTS_REPLACE);
-    $node->video_upload_file->newfile = TRUE;
+    $node->video_upload_file = $file = file_save_upload($file, $temppath .'/'. $file->filename, FILE_EXISTS_REPLACE);
+    $node->new_vidfile = true;
+    $file->fid = db_next_id('{files}_fid');
+    db_query("INSERT INTO {files} (fid, nid, filename, filepath, filemime, filesize) VALUES (%d, %d, '%s', '%s', '%s', %d)", $file->fid, 1, $file->filename, $file->filepath, $file->filemime, $file->filesize);
+    $node->video_fid = $file->fid;
     
     // set video size
     $node->size = $node->video_upload_file->filesize;
-
-    $_SESSION['video_upload_file'] = $node->video_upload_file;
-  }
-  else if (!empty($_SESSION['video_upload_file'])) {
-    $node->video_upload_file = $_SESSION['video_upload_file'];
-    // set video size
-    $node->size = $node->video_upload_file->filesize;
-
-  } else {
-    $_SESSION['video_upload_file'] = $node->video_upload_file;
   }
 }
 
 
 function _video_upload_store(&$node) {
-  if(!empty($_SESSION['video_upload_file'])) {
-    $file = $_SESSION['video_upload_file'];
+  if ($node->video_fid) {
+    $file = _video_upload_fetch_file($node->video_fid);
     $dest_dir = variable_get('video_upload_default_path', 'videos') .'/';
-    if ($file = file_save_upload($file, $dest_dir . $file->filename)) {
-      $file->fid = db_next_id('{files}_fid');
-      db_query("INSERT INTO {files} (fid, nid, filename, filepath, filemime, filesize) VALUES (%d, %d, '%s', '%s', '%s', %d)", $file->fid, $node->nid, $file->filename, $file->filepath, $file->filemime, $file->filesize);
+    if (file_move($file, $dest_dir . $file->filename)) {
+      db_query("UPDATE {files} SET nid = %d, filename = '%s', filepath = '%s', filemime = '%s', filesize = %d WHERE fid = %d", $node->nid, $file->filename, $file->filepath, $file->filemime, $file->filesize, $file->fid);
       db_query("INSERT INTO {file_revisions} (fid, vid, list, description) VALUES (%d, %d, %d, '%s')", $file->fid, $node->vid, $file->list, $file->description);
-      $_SESSION['video_upload_file_stored'] = $file;
-      unset($_SESSION['video_upload_file']);
+      $node->video_upload_file_stored = $file;
     }
     else {
       drupal_set_message(t('An error occurred during file saving. Your video file has not been stored.'), 'error');
@@ -246,6 +254,25 @@
   }
 }
 
+function _video_upload_update(&$node) {
+  $video_upload_file = _video_upload_load_file($node);
+  if ($node->video_fid != $video_upload_file->fid) {
+    $node->video_upload_file = $video_upload_file;
+    _video_upload_delete($node);
+    _video_upload_store($node);
+    $node->vidfile = file_create_url($node->video_upload_file->filepath);
+  }
+}
+
+function _video_upload_fetch_file($fid) {
+  static $files = array();
+
+  if (!isset($files[$fid])) {
+    $files[$fid] = db_fetch_object(db_query('SELECT * from {files} WHERE fid = %d', $fid));
+  }
+  return $files[$fid];
+}
+
 
 /**
  * Delete files associated to this video node
@@ -264,9 +291,13 @@
 /**
 * Create video upload specific form fields
 */
-function _video_upload_form($node) {
+function _video_upload_form(&$node) {
   _video_upload_check_settings();
 
+  if (count($_POST) == 0) {
+    unset($_SESSION['video_upload_file_info']);
+  }
+
   $form = array();
 
   $form['video_upload_file'] = array(
@@ -277,21 +308,34 @@
     '#description' => t('The uploaded file will be used as video file for this node.<br /><b>NOTE:</b> The max upload size is') . ' ' . format_size(_video_upload_get_max_upload_size()) . '.',
   );
 
-  if (isset($node->video_upload_file)) {
-    $form['video_upload_file']['#prefix'] = theme('video_upload_file_info_form', $node);
-    $form['video_upload_file']['#title'] = t('Replace with');
+  $form['video_upload_file_info']['#after_build'][] = 'video_upload_add_info';
+  if ($node->new_vidfile) {
+    $form['video_fid'] = array('#type' => 'hidden', '#value' => $node->video_fid);
+    $_SESSION['video_upload_file_info'] = $node->video_upload_file;
+  }
+  else {
+    if ($node->video_fid) {
+      $_SESSION['video_upload_file_info'] = $node->video_upload_file;
+    }
+    $form['video_fid'] = array('#type' => 'hidden', '#default_value' => $node->video_fid);
   }
 
   return $form;
 }
 
+function video_upload_add_info($form_id, $edit) {
+  if ($_SESSION['video_upload_file_info']) {
+    $node = (object)($edit);
+    $node->video_upload_file = $_SESSION['video_upload_file_info'];
+    $form = array('#type' => 'item', '#value' => theme('video_upload_file_info_form', $node), '#weight' => -10);
+  }
+  return $form;
+}
 
 /**
  * Display informations about already uploaded file
  */
 function theme_video_upload_file_info_form(&$node) {
-  $output = '<p>' . t('A video file has been already uploaded.') . '</p>';
-
   // create array containing uploaded file informations
   $items = array(
   '<b>'. t('file name') .':</b> ' . $node->video_upload_file->filename,
@@ -301,7 +345,7 @@
   );
 
   // create information list
-  $output .= theme_item_list($items, t('uploaded video informations:'));
+  $output .= theme_item_list($items, t('uploaded video information:'));
 
   return $output;
 }
@@ -370,7 +414,7 @@
 function theme_video_upload_busy() {
   return '<div id="sending" style="display: none;">
 				 <h3>' . t('Sending video... please wait.') . '</h3>
-						<img src="'. drupal_get_path('module', 'video_upload') . '/busy.gif" alt="' . t('Sending video... please wait.') . '"/>
+						<img src="'. url(drupal_get_path('module', 'video_upload') . '/busy.gif').'" alt="' . t('Sending video... please wait.') . '"/>
             <p>'. t('Video upload could take some minutes.') . '<br /><a href="#" id="video_upload_cancel_link">abort upload.</a></p>
 						</div>';
 }
