Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/media_actions/README.txt,v
retrieving revision 1.1
diff -u -p -r1.1 README.txt
--- README.txt	14 Nov 2007 21:29:49 -0000	1.1
+++ README.txt	27 Feb 2008 01:07:29 -0000
@@ -3,15 +3,17 @@
 ********************************************************************
 Name: Media Actions Module
 Author: Patrick Fournier <patrick at whiskyechobravo dot com>
-Drupal: 5
+Drupal: 6
 ********************************************************************
 PREREQUISITES:
-* Actions (http://drupal.org/project/actions)
+* Trigger module (included in core)
+* Video Field (provided by Media Field module)
+* Embedded Video Field (provided by Embedded Media Field module)
 
 DESCRIPTION:
 
 This module defines actions related to media files management 
-for the Drupal Actions module. Actions provided by this module
+for the Drupal core action function. Actions provided by this module
 currently handle video storage on blip.tv; you are welcome to add
 similar actions to this module.
 
@@ -19,7 +21,7 @@ similar actions to this module.
 INSTALLATION:
 
 1. Place the entire media_actions directory into your Drupal modules
-   directory (normally sites/all/modules or modules).
+   directory (normally sites/all/modules).
 
 2. Enable the media_action module by navigating to:
 
@@ -29,9 +31,27 @@ INSTALLATION:
    to configure actions (usually a bad idea), they must be given
    the "administer actions" access permission:
    
-     Administer > User management > Access control
+     Administer > User management > Permissions
 
    When the module is enabled and the user has the "administer
    actions" permission, an "actions" menu should appear under 
    Administer > Site configuration in the menu system.
+   
+********************************************************************
+USE:
+1. Create a CCK content type with two fields: 
+  a. A Video Field (provided by the CCK mediafield module),
+     used for video uploads.
+  b. An Embedded Video Field (provided by Embedded Media Field module),
+     used to display the embedded blip.tv video.
+
+2. Configure the Media Actions at Administer > Site configuration > Actions.
+  a. Select the action(s) under "Make a new advanced action available" and
+     click Create.
+  b. Fill in the required information.
+     - Enter your Video Field (upload) name in the Local Video Field
+     Name section.
+     - Enter your Embedded Video Field (display) name in the Remote Video
+     Field Name section.
 
+When creating a node, the user should enter a filename in the Video Field. The file will be uploaded as usual to your Drupal server, then the media action will upload this file to blip.tv, delete the local file and modify the Embedded Video Field to point to the newly created blip.tv video.
Index: media_actions.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/media_actions/media_actions.inc,v
retrieving revision 1.1
diff -u -p -r1.1 media_actions.inc
--- media_actions.inc	14 Nov 2007 21:29:49 -0000	1.1
+++ media_actions.inc	27 Feb 2008 01:07:29 -0000
@@ -1,365 +1,24 @@
-<?PHP
+<?php
 /* $Id: media_actions.inc,v 1.1 2007/11/14 21:29:49 pfournier Exp $ */
 
 /**
  * @file
- * Contains actions for use with the actions module.
- * These actions manage video file storage on bliptv.
+ * Contains helper functions for actions that
+ * manage video file storage on bliptv.
  */
 
 /**
- * Action definition: put file on bliptv.
- *
- */
-function action_bliptv_store($op, $edit = array(), &$node) {
-  switch ($op) {
-    case 'do':
-      if (_bliptv_send($node, $edit)) {
-        if (!$edit['defer']) {
-          node_save($node);
-        }
-        watchdog('action', t('Sent node id %id media to blip.tv', array('%id' => intval($node->nid))));
-      }
-      break;
-
-    case 'metadata':
-      return array(
-        'description' => t('Send media to blip.tv'),
-        'type' => t('Media'),
-        'batchable' => TRUE,
-        'configurable' => TRUE,
-      );
-
-    // Return an HTML config form for the action.
-    case 'form':
-      // default values for form
-      if (!isset($edit['bliptv_username'])) $edit['bliptv_username'] = '';
-      if (!isset($edit['bliptv_password'])) $edit['bliptv_password'] = '';
-      if (!isset($edit['bliptv_timeout'])) $edit['bliptv_timeout'] = '300';
-      if (!isset($edit['bliptv_license'])) $edit['bliptv_license'] = '1';
-      if (!isset($edit['blitv_signature'])) $edit['blitv_signature'] = '';
-      if (!isset($edit['bliptv_srcfield'])) $edit['bliptv_srcfield'] = 'local_video';
-      if (!isset($edit['bliptv_dstfield'])) $edit['bliptv_dstfield'] = 'remote_video';
-      $form = array();
-
-      // add form components
-      $form['bliptv_username'] = array(
-        '#type' => 'textfield',
-        '#title' => t('blip.tv user name'),
-        '#description' => t("Name of the blip.tv user."),
-        '#default_value' => $edit['bliptv_username'],
-        '#size' => '20',
-        '#maxlength' => '254',
-      );
-      $form['bliptv_password'] = array(
-        '#type' => 'textfield',
-        '#title' => t('blip.tv password'),
-        '#default_value' => $edit['bliptv_password'],
-        '#size' => '20',
-        '#maxlength' => '254',
-        '#description' => t('Password for the blip.tv user above.'),
-      );
-      $form['bliptv_timeout'] = array(
-        '#type' => 'textfield',
-        '#title' => t('Upload timeout'),
-        '#default_value' => $edit['bliptv_timeout'],
-        '#after_field' => t('seconds'),
-        '#size' => '4',
-        '#maxlength' => '4',
-        '#description' => t('How long we should wait for the transfer from our server to blip.tv server to complete.'),
-      );
-      $license['-1'] = 'No license (All rights reserved)';
-      $license['1'] = 'Creative Commons Attribution';
-      $license['2'] = 'Creative Commons Attribution-NoDerivs';
-      $license['3'] = 'Creative Commons Attribution-NonCommercial-NoDerivs';
-      $license['4'] = 'Creative Commons Attribution-NonCommercial';
-      $license['5'] = 'Creative Commons Attribution-NonCommercial-ShareAlike';
-      $license['6'] = 'Creative Commons Attribution-ShareAlike';
-      $license['7'] = 'Public Domain';
-      $form['bliptv_license'] =  array(
-        '#type' => 'select',
-        '#title' => t('Global License Type'),
-        '#options' => $license,
-        '#default_value' => $edit['bliptv_license'],
-        '#description' => t('All video will be uploaded and attached with the specified license. Description of licenses here <a href="http://creativecommons.org/licenses/">www.creativecommons.org/licenses</a>'),
-      );
-      $form['bliptv_signature'] = array(
-        '#type' => 'textfield',
-        '#title' => t('Global Signature'),
-        '#length' => 5,
-        '#default_value' => $edit['bliptv_signature'],
-        '#description' => t('This text will be appended to any video description uploaded to your blip.tv account e.g. a link back to your site from blip.tv')
-      );
-      $form['bliptv_srcfield'] = array(
-        '#type' => 'textfield',
-        '#title' => t('Local Video Field Name'),
-        '#default_value' => $edit['bliptv_srcfield'],
-        '#description' => t("Name of the node field containing the video file path."),
-      );
-      $form['bliptv_dstfield'] = array(
-        '#type' => 'textfield',
-        '#title' => t('Remote Video Field Name'),
-        '#default_value' => $edit['bliptv_dstfield'],
-        '#description' => t("Name of the node field where the uploaded video URL will be stored."),
-      );
-      
-      return $form;
-      
-    // Validate the HTML form.
-    case 'validate':
-      $errors = array();
-      if ($edit['bliptv_username'] == "") {
-        $errors['bliptv_username'] =  t("You must provide a blip.tv user name.");
-      }
-      if ($edit['bliptv_password'] == "") {
-        $errors['bliptv_password'] =  t("You must provide a blip.tv password.");
-      }
-      if (!is_numeric($edit['bliptv_timeout']) || ((int)$edit['bliptv_timeout'] < 0)) {
-        $errors['bliptv_timeout'] = t("The timeout must be a non-negative numeric value.");
-      }
-      
-      foreach ($errors as $name => $message) {
-        form_set_error($name, $message);
-      }
-      
-      return count($errors) == 0;
-
-    // Process the HTML form to store configuration.
-    case 'submit':
-      $params = array(
-        'bliptv_username' => $edit['bliptv_username'],
-        'bliptv_password' => $edit['bliptv_password'],
-        'bliptv_timeout'  => $edit['bliptv_timeout'],
-        'bliptv_license'  => $edit['bliptv_license'],
-        'blitv_signature' => $edit['blitv_signature'],
-        'bliptv_srcfield' => $edit['bliptv_srcfield'],
-        'bliptv_dstfield' => $edit['bliptv_dstfield'],
-      );
-      return $params;
-  }
-}
-
-/**
- * Action definition:update file on bliptv.
- *
- */
-function action_bliptv_update($op, $edit = array(), &$node) {
-  switch ($op) {
-    case 'do':
-      if (_bliptv_update($node, $edit)) {
-        if (!$edit['defer']) {
-          node_save($node);
-        }
-        watchdog('action', t('Updated node id %id media on blip.tv', array('%id' => intval($node->nid))));
-      }
-      break;
-
-    case 'metadata':
-      return array(
-        'description' => t('Update media on blip.tv'),
-        'type' => t('Media'),
-        'batchable' => TRUE,
-        'configurable' => TRUE,
-      );
-
-    // Return an HTML config form for the action.
-    case 'form':
-      // default values for form
-      if (!isset($edit['bliptv_username'])) $edit['bliptv_username'] = '';
-      if (!isset($edit['bliptv_password'])) $edit['bliptv_password'] = '';
-      if (!isset($edit['bliptv_timeout'])) $edit['bliptv_timeout'] = '300';
-      if (!isset($edit['bliptv_license'])) $edit['bliptv_license'] = '1';
-      if (!isset($edit['blitv_signature'])) $edit['blitv_signature'] = '';
-      if (!isset($edit['bliptv_srcfield'])) $edit['bliptv_srcfield'] = 'local_video';
-      if (!isset($edit['bliptv_dstfield'])) $edit['bliptv_dstfield'] = 'remote_video';
-      $form = array();
-
-      // add form components
-      $form['bliptv_username'] = array(
-        '#type' => 'textfield',
-        '#title' => t('blip.tv user name'),
-        '#description' => t("Name of the blip.tv user."),
-        '#default_value' => $edit['bliptv_username'],
-        '#size' => '20',
-        '#maxlength' => '254',
-      );
-      $form['bliptv_password'] = array(
-        '#type' => 'textfield',
-        '#title' => t('blip.tv password'),
-        '#default_value' => $edit['bliptv_password'],
-        '#size' => '20',
-        '#maxlength' => '254',
-        '#description' => t('Password for the blip.tv user above.'),
-      );
-      $form['bliptv_timeout'] = array(
-        '#type' => 'textfield',
-        '#title' => t('Upload timeout'),
-        '#default_value' => $edit['bliptv_timeout'],
-        '#after_field' => t('seconds'),
-        '#size' => '4',
-        '#maxlength' => '4',
-        '#description' => t('How long we should wait for the transfer from our server to blip.tv server to complete.'),
-      );
-      $license['-1'] = 'No license (All rights reserved)';
-      $license['1'] = 'Creative Commons Attribution';
-      $license['2'] = 'Creative Commons Attribution-NoDerivs';
-      $license['3'] = 'Creative Commons Attribution-NonCommercial-NoDerivs';
-      $license['4'] = 'Creative Commons Attribution-NonCommercial';
-      $license['5'] = 'Creative Commons Attribution-NonCommercial-ShareAlike';
-      $license['6'] = 'Creative Commons Attribution-ShareAlike';
-      $license['7'] = 'Public Domain';
-      $form['bliptv_license'] =  array(
-        '#type' => 'select',
-        '#title' => t('Global License Type'),
-        '#options' => $license,
-        '#default_value' => $edit['bliptv_license'],
-        '#description' => t('All video will be uploaded and attached with the specified license. Description of licenses here <a href="http://creativecommons.org/licenses/">www.creativecommons.org/licenses</a>'),
-      );
-      $form['bliptv_signature'] = array(
-        '#type' => 'textfield',
-        '#title' => t('Global Signature'),
-        '#length' => 5,
-        '#default_value' => $edit['bliptv_signature'],
-        '#description' => t('This text will be appended to any video description uploaded to your blip.tv account e.g. a link back to your site from blip.tv')
-      );
-      $form['bliptv_srcfield'] = array(
-        '#type' => 'textfield',
-        '#title' => t('Local Video Field Name'),
-        '#default_value' => $edit['bliptv_srcfield'],
-        '#description' => t("Name of the field containing the video file path."),
-      );
-      $form['bliptv_dstfield'] = array(
-        '#type' => 'textfield',
-        '#title' => t('Remote Video Field Name'),
-        '#default_value' => $edit['bliptv_dstfield'],
-        '#description' => t("Name of the field where the uploaded video URL will be stored."),
-      );
-      
-      return $form;
-      
-    // Validate the HTML form.
-    case 'validate':
-      $errors = array();
-      if ($edit['bliptv_username'] == "") {
-        $errors['bliptv_username'] =  t("You must provide a blip.tv user name.");
-      }
-      if ($edit['bliptv_password'] == "") {
-        $errors['bliptv_password'] =  t("You must provide a blip.tv password.");
-      }
-      if (!is_numeric($edit['bliptv_timeout']) || ((int)$edit['bliptv_timeout'] < 0)) {
-        $errors['bliptv_timeout'] = t("The timeout must be a non-negative numeric value.");
-      }
-      
-      foreach ($errors as $name => $message) {
-        form_set_error($name, $message);
-      }
-      
-      return count($errors) == 0;
-      
-    // Process the HTML form to store configuration.
-    case 'submit':
-      $params = array(
-        'bliptv_username' => $edit['bliptv_username'],
-        'bliptv_password' => $edit['bliptv_password'],
-        'bliptv_timeout'  => $edit['bliptv_timeout'],
-        'bliptv_license'  => $edit['bliptv_license'],
-        'blitv_signature' => $edit['blitv_signature'],
-        'bliptv_srcfield' => $edit['bliptv_srcfield'],
-        'bliptv_dstfield' => $edit['bliptv_dstfield'],
-      );
-      return $params;
-  }
-}
-
-/**
- * Action definition: remove file from bliptv.
- *
- */
-function action_bliptv_delete($op, $edit = array(), &$node) {
-  switch ($op) {
-    case 'do':
-      if (_bliptv_delete($node, $edit)) {
-        watchdog('action', t('Sent node id %id deleted from blip.tv', array('%id' => intval($node->nid))));
-      }
-      break;
-
-    case 'metadata':
-      return array(
-        'description' => t('Remove media from blip.tv'),
-        'type' => t('Media'),
-        'batchable' => TRUE,
-        'configurable' => TRUE,
-      );
-
-    // Return an HTML config form for the action.
-    case 'form':
-      // default values for form
-      if (!isset($edit['bliptv_username'])) $edit['bliptv_username'] = '';
-      if (!isset($edit['bliptv_password'])) $edit['bliptv_password'] = '';
-      if (!isset($edit['bliptv_dstfield'])) $edit['bliptv_dstfield'] = 'remote_video';
-      $form = array();
-
-      // Add form components.
-      $form['bliptv_username'] = array(
-        '#type' => 'textfield',
-        '#title' => t('blip.tv user name'),
-        '#description' => t("Name of the blip.tv user."),
-        '#default_value' => $edit['bliptv_username'],
-        '#size' => '20',
-        '#maxlength' => '254',
-      );
-      $form['bliptv_password'] = array(
-        '#type' => 'textfield',
-        '#title' => t('blip.tv password'),
-        '#default_value' => $edit['bliptv_password'],
-        '#size' => '20',
-        '#maxlength' => '254',
-        '#description' => t('Password for the blip.tv user above.'),
-      );
-      $form['bliptv_dstfield'] = array(
-        '#type' => 'textfield',
-        '#title' => t('Remote Video Field Name'),
-        '#default_value' => $edit['bliptv_dstfield'],
-        '#description' => t("Name of the field where the uploaded video URL will be stored."),
-      );
-      
-      return $form;
-      
-    // Validate the HTML form.
-    case 'validate':
-      $errors = array();
-      if ($edit['bliptv_username'] == "") {
-        $errors['bliptv_username'] =  t("You must provide a blip.tv user name.");
-      }
-      if ($edit['bliptv_password'] == "") {
-        $errors['bliptv_password'] =  t("You must provide a blip.tv password.");
-      }
-      
-      foreach ($errors as $name => $message) {
-        form_set_error($name, $message);
-      }
-      
-      return count($errors) == 0;
-      
-    // Process the HTML form to store configuration.
-    case 'submit':
-      $params = array(
-        'bliptv_username' => $edit['bliptv_username'],
-        'bliptv_password' => $edit['bliptv_password'],
-        'bliptv_dstfield' => $edit['bliptv_dstfield'],
-      );
-      return $params;
-  }
-}
-
-
-/**
  * Sends file to bliptv.
- * @node Node containing file to send.
- * @params Action configuration parameters.
- * @blid_file_id If this is set, we will update the bliptv file instead of creating a new one.
- * @return False on error, TRUE on success.
- *
+ * 
+ * @param $node
+ *  Node containing file to send.
+ * @param $params
+ *  Action configuration parameters.
+ * @param $blid_file_id
+ *  If this is set, we will update the bliptv file instead of creating
+ *  a new one.
+ * @return
+ *  False on error, TRUE on success.
  */
 function _bliptv_send($node, $params = array(), $blip_file_id = null) {
   // check user name
@@ -482,10 +141,13 @@ function _bliptv_send($node, $params = a
 
 /**
  * Update file on bliptv.
- * @node Node containing file to update.
- * @params Action configuration parameters.
- * @return FALSE on error, TRUE on success.
  *
+ * @param $node
+ *  Node containing file to update.
+ * @param $params
+ *  Action configuration parameters.
+ * @return
+ *  FALSE on error, TRUE on success.
  */
 function _bliptv_update($node, $params = array()) {
   if ((! $remote_video_field_name = $params['bliptv_dstfield'])) {
@@ -503,10 +165,13 @@ function _bliptv_update($node, $params =
 
 /**
  * Delete file from bliptv.
- * @node Node containing file to delete.
- * @params Action configuration parameters.
- * @return FALSE on error, TRUE on success.
  *
+ * @param $node
+ *  Node containing file to delete.
+ * @param $params
+ *  Action configuration parameters.
+ * @return
+ *  FALSE on error, TRUE on success.
  */
 function _bliptv_delete($node, $params = array()) {
   // check user name
Index: media_actions.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/media_actions/media_actions.info,v
retrieving revision 1.2
diff -u -p -r1.2 media_actions.info
--- media_actions.info	14 Nov 2007 21:31:51 -0000	1.2
+++ media_actions.info	27 Feb 2008 01:07:29 -0000
@@ -1,5 +1,8 @@
 ; $Id: media_actions.info,v 1.2 2007/11/14 21:31:51 pfournier Exp $
 name = Media Actions
 description = Provides media related actions.
-dependencies = actions
+core = 6.x
+dependencies[] = trigger
+dependencies[] = videofield
+dependencies[] = emfield
 package = Actions
Index: media_actions.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/media_actions/media_actions.module,v
retrieving revision 1.1
diff -u -p -r1.1 media_actions.module
--- media_actions.module	14 Nov 2007 21:29:49 -0000	1.1
+++ media_actions.module	27 Feb 2008 01:07:29 -0000
@@ -1,4 +1,321 @@
 <?php
 /* $Id: media_actions.module,v 1.1 2007/11/14 21:29:49 pfournier Exp $ */
 
-include_once(drupal_get_path('module', 'media_actions') . '/media_actions.inc');
\ No newline at end of file
+// Include the blip.tv API helper functions.
+include_once(drupal_get_path('module', 'media_actions') .'/media_actions.inc');
+
+/**
+ * Implementation of hook_action_info().
+ */
+function media_actions_action_info() {
+  return array(
+    'media_actions_bliptv_store_action' => array(
+      'description' => t('Send media to blip.tv'),
+      'type' => 'node',
+      'configurable' => TRUE,
+      'hooks' => array(
+        'any' => TRUE,
+      ),
+    ),
+    'media_actions_bliptv_update_action' => array(
+      'description' => t('Update media on blip.tv'),
+      'type' => 'node',
+      'configurable' => TRUE,
+      'hooks' => array(
+        'any' => TRUE,
+      ),
+    ),
+    'media_actions_bliptv_delete_action' => array(
+      'description' => t('Remove media from blip.tv'),
+      'type' => 'node',
+      'configurable' => TRUE,
+      'hooks' => array(
+        'any' => TRUE,
+      ),
+    ),
+  );
+}
+
+/*********** Uplaod a video to blip.tv***********/
+
+/**
+ * Action definition: put file on bliptv.
+ */
+function media_actions_bliptv_store_action($node, $context) {
+  if (_bliptv_send($node, $context)) {
+    if (!$context['defer']) {
+      node_save($node);
+    }
+    watchdog('action', 'Sent node id %id media to blip.tv', array('%id' => intval($node->nid)));
+  }
+}
+
+/**
+ * Return a configuration form for the bliptv_store actions.
+ */
+function media_actions_bliptv_store_action_form($context) {
+  if (!isset($context['bliptv_username'])) $context['bliptv_username'] = '';
+  if (!isset($context['bliptv_password'])) $context['bliptv_password'] = '';
+  if (!isset($context['bliptv_timeout'])) $context['bliptv_timeout'] = '300';
+  if (!isset($context['bliptv_license'])) $context['bliptv_license'] = '1';
+  if (!isset($context['bliptv_signature'])) $context['bliptv_signature'] = '';
+  if (!isset($context['bliptv_srcfield'])) $context['bliptv_srcfield'] = 'local_video';
+  if (!isset($context['bliptv_dstfield'])) $context['bliptv_dstfield'] = 'remote_video';
+  $form = array();
+
+  // add form components
+  $form['bliptv_username'] = array(
+    '#type' => 'textfield',
+    '#title' => t('blip.tv user name'),
+    '#description' => t("Name of the blip.tv user."),
+    '#default_value' => $context['bliptv_username'],
+    '#size' => '20',
+    '#maxlength' => '254',
+    '#required' => TRUE,
+  );
+  $form['bliptv_password'] = array(
+    '#type' => 'password',
+    '#title' => t('blip.tv password'),
+    '#default_value' => $context['bliptv_password'],
+    '#size' => '20',
+    '#maxlength' => '254',
+    '#description' => t('Password for the blip.tv user above.'),
+    '#required' => TRUE,
+  );
+  $form['bliptv_timeout'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Upload timeout'),
+    '#default_value' => $context['bliptv_timeout'],
+    '#after_field' => t('seconds'),
+    '#size' => '4',
+    '#maxlength' => '4',
+    '#description' => t('How long we should wait for the transfer from our server to blip.tv server to complete.'),
+    '#required' => TRUE,
+  );
+  $license['-1'] = 'No license (All rights reserved)';
+  $license['1'] = 'Creative Commons Attribution';
+  $license['2'] = 'Creative Commons Attribution-NoDerivs';
+  $license['3'] = 'Creative Commons Attribution-NonCommercial-NoDerivs';
+  $license['4'] = 'Creative Commons Attribution-NonCommercial';
+  $license['5'] = 'Creative Commons Attribution-NonCommercial-ShareAlike';
+  $license['6'] = 'Creative Commons Attribution-ShareAlike';
+  $license['7'] = 'Public Domain';
+  $form['bliptv_license'] =  array(
+    '#type' => 'select',
+    '#title' => t('Global License Type'),
+    '#options' => $license,
+    '#default_value' => $context['bliptv_license'],
+    '#description' => t('All video will be uploaded and attached with the specified license. Description of licenses here <a href="http://creativecommons.org/licenses/">www.creativecommons.org/licenses</a>'),
+  );
+  $form['bliptv_signature'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Global Signature'),
+    '#default_value' => $context['bliptv_signature'],
+    '#description' => t('This text will be appended to any video description uploaded to your blip.tv account e.g. a link back to your site from blip.tv')
+  );
+  $form['bliptv_srcfield'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Local Video Field Name'),
+    '#default_value' => $context['bliptv_srcfield'],
+    '#description' => t("Name of the node field containing the video file path."),
+    '#required' => TRUE,
+  );
+  $form['bliptv_dstfield'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Remote Video Field Name'),
+    '#default_value' => $context['bliptv_dstfield'],
+    '#description' => t("Name of the node field where the uploaded video URL will be stored."),
+    '#required' => TRUE,
+  );
+  
+  return $form;
+}
+
+/**
+ * Submit function for the configuration form for the bliptv_store action.
+ */
+function media_actions_bliptv_store_action_submit($form, &$form_state) {
+  $params = array(
+    'bliptv_username' => $form_state['values']['bliptv_username'],
+    'bliptv_password' => $form_state['values']['bliptv_password'],
+    'bliptv_timeout'  => $form_state['values']['bliptv_timeout'],
+    'bliptv_license'  => $form_state['values']['bliptv_license'],
+    'bliptv_signature' => $form_state['values']['bliptv_signature'],
+    'bliptv_srcfield' => $form_state['values']['bliptv_srcfield'],
+    'bliptv_dstfield' => $form_state['values']['bliptv_dstfield'],
+  );
+  return $params;
+}
+
+/*********** Update a video on blip.tv***********/
+
+/**
+ * Action definition: update file on bliptv.
+ */
+function media_actions_bliptv_update_action($node, $context) {
+  if (_bliptv_update($node, $context)) {
+    if (!$context['defer']) {
+      node_save($node);
+    }
+    watchdog('action', 'Updated node id %id media on blip.tv', array('%id' => intval($node->nid)));
+  }
+}
+
+/**
+ * Return a configuration form for the bliptv_update action.
+ */
+function media_actions_bliptv_update_action_form($context) {
+  if (!isset($context['bliptv_username'])) $context['bliptv_username'] = '';
+  if (!isset($context['bliptv_password'])) $context['bliptv_password'] = '';
+  if (!isset($context['bliptv_timeout'])) $context['bliptv_timeout'] = '300';
+  if (!isset($context['bliptv_license'])) $context['bliptv_license'] = '1';
+  if (!isset($context['bliptv_signature'])) $context['bliptv_signature'] = '';
+  if (!isset($context['bliptv_srcfield'])) $context['bliptv_srcfield'] = 'local_video';
+  if (!isset($context['bliptv_dstfield'])) $context['bliptv_dstfield'] = 'remote_video';
+  $form = array();
+
+  // add form components
+  $form['bliptv_username'] = array(
+    '#type' => 'textfield',
+    '#title' => t('blip.tv user name'),
+    '#description' => t("Name of the blip.tv user."),
+    '#default_value' => $context['bliptv_username'],
+    '#size' => '20',
+    '#maxlength' => '254',
+    '#required' => TRUE,
+  );
+  $form['bliptv_password'] = array(
+    '#type' => 'password',
+    '#title' => t('blip.tv password'),
+    '#default_value' => $context['bliptv_password'],
+    '#size' => '20',
+    '#maxlength' => '254',
+    '#description' => t('Password for the blip.tv user above.'),
+    '#required' => TRUE,
+  );
+  $form['bliptv_timeout'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Upload timeout'),
+    '#default_value' => $context['bliptv_timeout'],
+    '#after_field' => t('seconds'),
+    '#size' => '4',
+    '#maxlength' => '4',
+    '#description' => t('How long we should wait for the transfer from our server to blip.tv server to complete.'),
+    '#required' => TRUE,
+  );
+  $license['-1'] = 'No license (All rights reserved)';
+  $license['1'] = 'Creative Commons Attribution';
+  $license['2'] = 'Creative Commons Attribution-NoDerivs';
+  $license['3'] = 'Creative Commons Attribution-NonCommercial-NoDerivs';
+  $license['4'] = 'Creative Commons Attribution-NonCommercial';
+  $license['5'] = 'Creative Commons Attribution-NonCommercial-ShareAlike';
+  $license['6'] = 'Creative Commons Attribution-ShareAlike';
+  $license['7'] = 'Public Domain';
+  $form['bliptv_license'] =  array(
+    '#type' => 'select',
+    '#title' => t('Global License Type'),
+    '#options' => $license,
+    '#default_value' => $context['bliptv_license'],
+    '#description' => t('All video will be uploaded and attached with the specified license. Description of licenses here <a href="http://creativecommons.org/licenses/">www.creativecommons.org/licenses</a>'),
+  );
+  $form['bliptv_signature'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Global Signature'),
+    '#default_value' => $context['bliptv_signature'],
+    '#description' => t('This text will be appended to any video description uploaded to your blip.tv account e.g. a link back to your site from blip.tv')
+  );
+  $form['bliptv_srcfield'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Local Video Field Name'),
+    '#default_value' => $context['bliptv_srcfield'],
+    '#description' => t("Name of the field containing the video file path."),
+    '#required' => TRUE,
+  );
+  $form['bliptv_dstfield'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Remote Video Field Name'),
+    '#default_value' => $context['bliptv_dstfield'],
+    '#description' => t("Name of the field where the uploaded video URL will be stored."),
+    '#required' => TRUE,
+  );
+  
+  return $form;
+}
+
+/**
+ * Submit function for the configuration form for the bliptv_store action.
+ */
+function media_actions_bliptv_update_action_submit($form, &$form_state) {
+  $params = array(
+    'bliptv_username' => $form_state['values']['bliptv_username'],
+    'bliptv_password' => $form_state['values']['bliptv_password'],
+    'bliptv_timeout'  => $form_state['values']['bliptv_timeout'],
+    'bliptv_license'  => $form_state['values']['bliptv_license'],
+    'bliptv_signature' => $form_state['values']['bliptv_signature'],
+    'bliptv_srcfield' => $form_state['values']['bliptv_srcfield'],
+    'bliptv_dstfield' => $form_state['values']['bliptv_dstfield'],
+  );
+  return $params;
+}
+
+/*********** Delete a video on blip.tv***********/
+
+/**
+ * Action definition: delete a file on bliptv.
+ */
+function media_actions_bliptv_delete_action($node, $context) {
+  if (_bliptv_delete($node, $edit)) {
+    watchdog('action', 'Sent node id %id deleted from blip.tv', array('%id' => intval($node->nid)));
+  }
+}
+
+/**
+ * Return a configuration form for the bliptv_update action.
+ */
+function media_actions_bliptv_delete_action_form($context) {
+  if (!isset($context['bliptv_username'])) $context['bliptv_username'] = '';
+  if (!isset($context['bliptv_password'])) $context['bliptv_password'] = '';
+  if (!isset($context['bliptv_dstfield'])) $context['bliptv_dstfield'] = 'remote_video';
+  $form = array();
+
+  // Add form components.
+  $form['bliptv_username'] = array(
+    '#type' => 'textfield',
+    '#title' => t('blip.tv user name'),
+    '#description' => t("Name of the blip.tv user."),
+    '#default_value' => $context['bliptv_username'],
+    '#size' => '20',
+    '#maxlength' => '254',
+    '#required' => TRUE,
+  );
+  $form['bliptv_password'] = array(
+    '#type' => 'password',
+    '#title' => t('blip.tv password'),
+    '#default_value' => $context['bliptv_password'],
+    '#size' => '20',
+    '#maxlength' => '254',
+    '#description' => t('Password for the blip.tv user above.'),
+    '#required' => TRUE,
+  );
+  $form['bliptv_dstfield'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Remote Video Field Name'),
+    '#default_value' => $context['bliptv_dstfield'],
+    '#description' => t("Name of the field where the uploaded video URL will be stored."),
+    '#required' => TRUE,
+  );
+  
+  return $form;
+}
+
+/**
+ * Submit function for the configuration form for the bliptv_store action.
+ */
+function media_actions_bliptv_delete_action_submit($form, &$form_state) {
+  $params = array(
+    'bliptv_username' => $form_state['values']['bliptv_username'],
+    'bliptv_password' => $form_state['values']['bliptv_password'],
+    'bliptv_dstfield' => $form_state['values']['bliptv_dstfield'],
+  );
+  return $params;
+}
