A client's site I'm working on is interested in using Encoding.com for off-site encoding of video files (instead of local FFMPEG), as well as final storage/serving of the files on Amazon S3. The videos would ultimately be connected to a node for each, owned by the user who uploaded it. Encoding.com is able to send its encoded files directly to S3 after completion. I wanted to see if this might be a possible scenario for Media Mover? Would an additional sub-module need to be created to accomplish this? If so, any hints as to what it might entail to accomplish this would be greatly appreciated :) Encoding.com has expressed interest (when my client spoke to them) in a solution for Drupal, so anything that might help clarify what it would take to accomplish would be very helpful.

Thanks in advance :)

Comments

godewebog’s picture

Have anybody started to work on it? It would be a very useful and popular module.

arthurf’s picture

You could probably do something like this. You basically just need to fill in the last function and you're good to go.

<?php

/**
 * Implementation of media_mover hook
 * @param $op is the operator to return
 * @param $action is which action is being called
 * @param $verb is the verb being run
 * @param $configuration is the specific configuration saved for the action for this configuration
 * @param $file is the file in use
 * @param $job is the full configuration data currently running
 */
function encoding_media_mover($op = null, $action = null, $configuration = null, &$file = array(), $job = null, $nid = null ) {
  switch ($op) {
    // give your module a distinct name
    case 'name':
      return "Media Mover Encoding.com";
    break;

    // defines the actions that this module does
    case 'actions':
      return array(
        'process' => array(
          1 => t('Send file to Encoding.com'),
        ),
      );
    break;

    // create edit configuration option set
    case 'config':
      return encoding_config($configuration);
    break;

    case 'process':
      return encoding_process($file, $configuration);
    break;
  }
}

/**
 * Creates the configuration form
 * @param $configuration
 * @return array
 */
function encoding_config($configuration) {
  // some drupal form elements here
  $form['encoding_user'] = array(
    '#type' => 'textfield',
    '#title' => t('Encoding.com user'),
    '#default_value' => $configuration['encoding_user'],
    '#description' => t('Enter your user'),
  );
  return $form;
}

/**
 * move the file to encoding.com
 * @param $file
 * @param $configuration
 */
function encoding_process($file, $configuration) {
  // get the path to the file to operate on. 
  $filepath = media_mover_api_config_current_file($file);
  
  // open connection to encoding.com
  
  // transfer file
  
  // tell encoding.com what to do with it
  
  // get the new file path back from encoding.com
  
  return $filepath;
}
?>
godewebog’s picture

Thank you for the code! It is a good start point to implement encoding.com plugin for media_mover. I am working on such module. However it may take time because I have not a big expirience with encoding.com api and media_mover api. I will share this as soon as it is ready. So any help in it will be apprecated (may be somebody has implemented the task already?)

arthurf’s picture

I'm happy to help with the MM side. I'll also port the module to the 2.0 version of MM once that code gets more stable. The API for 2.0 is better, but there are no real changes for the module developer side.

denisanokhin’s picture

@godewebug. Any news on the encoding.com integration module? Could you please share the module?

matt2000’s picture

I just committed some initial code at:

http://drupal.org/project/encoding

it doesn't work yet, but if others want to jump in and help get a 1.0 ready, let me know.

drupal a11y’s picture

Any news on this? Especially maybe also for D7 ????

marif321’s picture

any progress???