| 1 |
$Id: README.txt,v 1.16 2008/01/19 18:26:24 bdragon Exp $
|
| 2 |
|
| 3 |
This is the Media Mover module.
|
| 4 |
|
| 5 |
If you're using the s3 module, please download the pear and s3 drivers here:
|
| 6 |
|
| 7 |
http://www.24b6.net/files/drivers.tgz
|
| 8 |
|
| 9 |
If you're having issues with FFmpeg, you can try out a binary here:
|
| 10 |
|
| 11 |
http://tunaspecial.com/files/ffmpeg.tgz
|
| 12 |
|
| 13 |
|
| 14 |
-----------------------------------------------------------------------
|
| 15 |
REQUIRES
|
| 16 |
-----------------------------------------------------------------------
|
| 17 |
FFmpeg requires a FFmpeg binary
|
| 18 |
S3 support requires the drivers file referenced above
|
| 19 |
|
| 20 |
Automatic file creation may not work on Windows due to path names. Not sure, hasn't been tested.
|
| 21 |
|
| 22 |
-----------------------------------------------------------------------
|
| 23 |
INSTALLATION
|
| 24 |
-----------------------------------------------------------------------
|
| 25 |
Install the media_mover module directory under sites/all/modules or
|
| 26 |
sites/yoursite/modules
|
| 27 |
|
| 28 |
Go to admin/build/modules
|
| 29 |
|
| 30 |
Enable the Media Mover modules you want to use
|
| 31 |
|
| 32 |
-----------------------------------------------------------------------
|
| 33 |
CONFIGURATION
|
| 34 |
-----------------------------------------------------------------------
|
| 35 |
|
| 36 |
Go to admin/media_mover/settings
|
| 37 |
These are the global settings for the Media Mover modules
|
| 38 |
|
| 39 |
Make sure you configure the path to FFmpeg. This is relative to the root
|
| 40 |
of your server. If don't know where FFmpeg is installed and you have
|
| 41 |
access to the command line of your server, you can run:
|
| 42 |
|
| 43 |
#locate ffmpeg
|
| 44 |
|
| 45 |
This should hopefully give you a path to ffmpeg.
|
| 46 |
If you need install FFmpeg, there are instructions here for installing
|
| 47 |
it on a debian/ubuntu environment:
|
| 48 |
|
| 49 |
http://www.24b6.net/?p=188
|
| 50 |
|
| 51 |
-----------------------------------------------------------------------
|
| 52 |
USAGE
|
| 53 |
-----------------------------------------------------------------------
|
| 54 |
|
| 55 |
Goto admin/media_mover to build a configuration
|
| 56 |
|
| 57 |
Each configuration can have its own options, so you can make a configuration
|
| 58 |
that converts a video, and then another configuration which makes a thumbnail
|
| 59 |
for that video.
|
| 60 |
|
| 61 |
Media Mover configurations will be run every time cron is run, though you
|
| 62 |
can run a single configuration by hand if you use the run option at
|
| 63 |
admin/media_mover
|
| 64 |
|
| 65 |
Example:
|
| 66 |
------------------------------------
|
| 67 |
You have a site where users upload video with their nodes. You want
|
| 68 |
these files converted to FLV format automatically. Media Mover can
|
| 69 |
find and convert the files, but you will need some additional theming
|
| 70 |
and potentially some additional modules.
|
| 71 |
|
| 72 |
1) add a new configuration
|
| 73 |
2) select "Media Mover node module: Select drupal uploaded files"
|
| 74 |
3) select the content types you wish to harvest from and the kinds
|
| 75 |
files you wish to harvest
|
| 76 |
4) select "FFmpeg module: convert video"
|
| 77 |
5) default options for conversion should work in most cases
|
| 78 |
6) select bypass for storage and complete
|
| 79 |
|
| 80 |
Once cron runs, uploaded files will be converted. Files are accessible
|
| 81 |
at $node->media_mover. To get the flv file to be shown in a flash
|
| 82 |
player, you can get the file path by $media->mover[X][0]['complete_file']
|
| 83 |
where X is the Media Mover configuration id.
|
| 84 |
|
| 85 |
You may find XSPF Playlist module and the SWFobject module helpful to
|
| 86 |
display videos.
|
| 87 |
|
| 88 |
|
| 89 |
-----------------------------------------------------------------------
|
| 90 |
DEVELOPERS
|
| 91 |
-----------------------------------------------------------------------
|
| 92 |
|
| 93 |
Documentation is here:
|
| 94 |
http://mediamover.24b6.net/
|
| 95 |
|
| 96 |
|
| 97 |
Media mover $item format
|
| 98 |
------------------------
|
| 99 |
|
| 100 |
$item = array(
|
| 101 |
// File arrays.
|
| 102 |
'harvest' => array(
|
| 103 |
// Candidate fields for node.
|
| 104 |
'node' => array(
|
| 105 |
|
| 106 |
),
|
| 107 |
|
| 108 |
// Is this file a locally accessible file?
|
| 109 |
'local' => TRUE,
|
| 110 |
),
|
| 111 |
'process' => array(
|
| 112 |
|
| 113 |
),
|
| 114 |
'storage' => array(
|
| 115 |
|
| 116 |
),
|
| 117 |
'complete' => array(
|
| 118 |
|
| 119 |
),
|
| 120 |
|
| 121 |
// Media mover ID.
|
| 122 |
'mmfid' => 12345,
|
| 123 |
|
| 124 |
// Status === 0 means there was a failure.
|
| 125 |
// Modules should stop processing in this case. (@@@ Why do we continue in
|
| 126 |
// this case, anyway?)
|
| 127 |
'status' => 1,
|
| 128 |
|
| 129 |
// Sometimes there may be an associated node.
|
| 130 |
// @@@ Make sure code doesn't rely on this.
|
| 131 |
// @@@ Node per-action?
|
| 132 |
'nid' => 12345,
|
| 133 |
|
| 134 |
// User ID these files are owned by.
|
| 135 |
'uid' => 12345,
|
| 136 |
);
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
Here's an example of the media mover hook
|
| 147 |
|
| 148 |
/**
|
| 149 |
* Implementation of media_mover hook
|
| 150 |
*/
|
| 151 |
function my_media_mover($op, $action = null, $configuration = null, &$file = array() ) {
|
| 152 |
|
| 153 |
switch ($op) {
|
| 154 |
|
| 155 |
// give your module a distinct name
|
| 156 |
case 'name':
|
| 157 |
return "My module name";
|
| 158 |
break;
|
| 159 |
|
| 160 |
// defines the actions that this module does
|
| 161 |
// structure is an array of media mover verbs
|
| 162 |
// with an array of actions for each verb
|
| 163 |
// $actions[$verb][$action_id] Your ids only
|
| 164 |
// need to be unique to your module and should
|
| 165 |
// not contain spaces
|
| 166 |
case 'actions':
|
| 167 |
return array(
|
| 168 |
'harvest' => array(
|
| 169 |
'action_1' => t('select drupal uploaded files'),
|
| 170 |
'action_2' => t('select files from some source'),
|
| 171 |
),
|
| 172 |
'storage' => array(
|
| 173 |
'action_3' => t('Save data as a node'),
|
| 174 |
'action_4' => t('Attach converted file to node'),
|
| 175 |
)
|
| 176 |
);
|
| 177 |
break;
|
| 178 |
|
| 179 |
// create edit configuration option set
|
| 180 |
// The creation of a Media Mover configuration pulls the
|
| 181 |
// configuration form from every module.
|
| 182 |
case 'config':
|
| 183 |
switch ($action_id) {
|
| 184 |
|
| 185 |
// here are internal media mover options
|
| 186 |
case 'action_1': //select_drupal_uploaded_files
|
| 187 |
return _media_mover_admin_harvest_config($action_id, $configuration);
|
| 188 |
break;
|
| 189 |
|
| 190 |
case 'action_2': //set node status
|
| 191 |
return _media_mover_admin_complete_config($action_id, $configuration);
|
| 192 |
break;
|
| 193 |
|
| 194 |
......
|
| 195 |
}
|
| 196 |
break;
|
| 197 |
|
| 198 |
// set global configuration for this module
|
| 199 |
// this is the global config. Configuration options for individaul
|
| 200 |
// configurations are in $op = "config"
|
| 201 |
// This displayed at admin/settings/media_mover
|
| 202 |
// return a form array
|
| 203 |
case 'admin':
|
| 204 |
return _media_mover_admin();
|
| 205 |
break;
|
| 206 |
|
| 207 |
|
| 208 |
// defines directories (under master media_mover directory) this module uses
|
| 209 |
// array of directories, will be created under the default
|
| 210 |
// media_mover directory, set in admin
|
| 211 |
case 'directories':
|
| 212 |
return array('converted_files', 'harvested_files');
|
| 213 |
break;
|
| 214 |
|
| 215 |
|
| 216 |
// allows for a module to return additional data for a given file when
|
| 217 |
// someone requests it
|
| 218 |
// called from media_mover's mm_files_db_fetch and _mm_file_db_fetch
|
| 219 |
// by default, medial_mover's files table is used. $file is available
|
| 220 |
case 'fetch':
|
| 221 |
break;
|
| 222 |
|
| 223 |
// allows for module to update additional critera
|
| 224 |
// add file to db action. called from media_mover's mm_files_db_update
|
| 225 |
// by default, medial_mover's files table is used. $file is available
|
| 226 |
case 'update':
|
| 227 |
break;
|
| 228 |
|
| 229 |
// functions called on harvest op
|
| 230 |
// returns an array of $files
|
| 231 |
case 'harvest':
|
| 232 |
switch($action_id) {
|
| 233 |
case 'action_1':
|
| 234 |
return _mm_harvest($action_id, $configuration);
|
| 235 |
break;
|
| 236 |
|
| 237 |
....
|
| 238 |
break;
|
| 239 |
|
| 240 |
// functions called on process op
|
| 241 |
case 'process':
|
| 242 |
break;
|
| 243 |
|
| 244 |
// functions called on storage op
|
| 245 |
case 'storage':
|
| 246 |
switch ($action_id) {
|
| 247 |
case 'storage--4':
|
| 248 |
return _mm_node_save($file, $configuration);
|
| 249 |
break;
|
| 250 |
}
|
| 251 |
break;
|
| 252 |
|
| 253 |
// functions called on completion
|
| 254 |
case 'complete':
|
| 255 |
return _mm_complete($configuration, $file);
|
| 256 |
break;
|
| 257 |
|
| 258 |
default:
|
| 259 |
return;
|
| 260 |
break;
|
| 261 |
}
|
| 262 |
}
|