I don't really understand how this module works. Maybe someone can give me some help? All I want it to do is rename the uploaded file to include the user's id number at the beginning of the file name.

example: video.flv renamed to 1_video.flv

after this, it is to be uploaded to an FTP server.

I've got it working to where it will upload the video to the FTP server no problem, but I can't figure out how to rename it. any help would be appreciated.

Comments

anantagati’s picture

You should fill into 'Output file' something like this: [user-id]_[harvest_file].
Instead of [harvest_file] you may use other states of file depending on in which action is Custom Command used.

And in 'Command' you can copy original file by this code: cp [harvest_file] [user-id]_[harvest_file]

robotsguide’s picture

I tried this and it didn't work. it also made it so it didn't transfer to the FTP server.

anantagati’s picture

Can you send me info about your configuration?

robotsguide’s picture

what do I need to send?

anantagati’s picture

You go to 'admin/build/media_mover/export' and export Media Mover configuration.

robotsguide’s picture

here's what you asked for:

$configuration = new stdClass;
$configuration->required = array('mm_cck', 'mm_custom_command', 'media_mover_ftp', 'media_mover_ftp');
$configuration->name = 'ftp';
$configuration->cid = '13';
$configuration->description = 'ftp rename';
$configuration->status = 'stopped';
$configuration->harvest->module = 'mm_cck';
$configuration->harvest->action = '1';
$configuration->harvest->configuration =  array(
  'mm_config_harvest_field' =>  array(
    'field_video_upload' => 'field_video_upload'
  ),
  'file_types' => 'avi mov wmv mpeg mp4 mpeg2 dv 3gp 3g2 mpeg4 flv',
  'cid' => '13',
  'module' => 'mm_cck',
  'action' => '1',
  'verb' => 'harvest'
);
$configuration->harvest->cid = '13';
$configuration->complete->module = 'media_mover_ftp';
$configuration->complete->action = '2';
$configuration->complete->configuration =  array(
  'mm_ftp_user' => '',
  'mm_ftp_pass' => '',
  'mm_ftp_host' => '',
  'mm_ftp_dir' => '.',
  'mm_ftp_url' => '<none>',
  'cid' => '13',
  'module' => 'media_mover_ftp',
  'action' => '2',
  'verb' => 'complete'
);
$configuration->complete->cid = '13';
$configuration->storage->module = 'media_mover_ftp';
$configuration->storage->action = '2';
$configuration->storage->configuration =  array(
  'mm_ftp_user' => 'castnwfvs',
  'mm_ftp_pass' => '', //I've omitted the password for safety reasons
  'mm_ftp_host' => 'fvsupload.cdnetworks.net',
  'mm_ftp_dir' => 'flashstream',
  'mm_ftp_url' => '<none>',
  'cid' => '13',
  'module' => 'media_mover_ftp',
  'action' => '2',
  'verb' => 'storage'
);
$configuration->storage->cid = '13';
$configuration->process->module = 'mm_custom_command';
$configuration->process->action = '1';
$configuration->process->configuration =  array(
  'output_file' => '[user-id]_[harvest_file]',
  'command' => 'cp [harvest_file] [user-id]_[harvest_file]',
  'cid' => '13',
  'module' => 'mm_custom_command',
  'action' => '1',
  'verb' => 'process'
);
$configuration->process->cid = '13';
$configuration->hierarchy->parent = '0';

thanks for your support!

anantagati’s picture

Ok, I looked on it more deeply and it seems that there is need to have some more tokens which will return just filepath, name or extension of file. [harvest_file] also contains path to the file (ex. sites/default/files/gallery/videos/gauranga.mov) so it is hard to use for this case.

I created issue #548062: [mm_token] More flexible tokens for working with files for media_mover/mm_token module.

robotsguide’s picture

Thank you!

robotsguide’s picture

Status: Active » Closed (fixed)

I figured this out using Filefield Paths. There are tokens available within that module to do exactly what I needed. Closing issue.