--- video.old.module	2007-01-14 09:59:06.000000000 -0500
+++ video.module	2007-01-26 01:31:32.000000000 -0500
@@ -1617,3 +1617,52 @@ function _video_get_parameters(&$node) {
   }
   return $output;
 }
+
+/**
+ * Function for other modules to use to create a video node from a file. Once
+ * you've created it you can make any changes and then save it using
+ * node_save(). Adapted from audio module.
+ *
+ * @param $filepath
+ *   full path to an video file.
+ * @return
+ *   a node or FALSE on error
+ */
+function video_api_insert($filepath = '', $title = 'video', $body = '', $width = 425, $height = 350, $video_size = 1, $seconds = 1) {
+  global $user;
+
+  //check for user permission...
+  if (!user_access('create')) {
+    drupal_access_denied();
+  }
+
+  // start building a node
+  $node = new stdClass();
+  $node->type = 'video';
+  $node->uid = $user->uid;
+  $node->name = $user->name;
+  $node->title = $title;
+  $node->body = $body;
+
+  // set the node's defaults... (copied this from node and comment.module)
+  $node_options = variable_get('node_options_'. $node->type, array('status', 'promote'));
+  $node->status = in_array('status', $node_options);
+  $node->moderate = in_array('moderate', $node_options);
+  $node->promote = in_array('promote', $node_options);
+  if (module_exists('comment')) {
+    $node->comment = variable_get("comment_$node->type", COMMENT_NODE_READ_WRITE);
+  }
+
+  // default video info
+  $node->size = $video_size;
+  $node->videox = $width;
+  $node->videoy = $height;
+  $node->playtime_seconds = $seconds;
+  $node->vidfile = $filepath;
+  
+  // ...then save it
+  $node = node_submit($node);
+  node_save($node);
+  drupal_set_message(t('Your video has been inserted.'));
+  return $node;
+}
