Fun Tricks with Media Mover 2.x

Media Mover 2.x has been slowly creeping along for the last bunch of months and is starting to approach an alpha state. One of the cool things about Media Mover 2 is that the architecture has been rewritten from the ground up. Now there are three main concepts - files that Media Move knows about, configurations which are a collection of steps, and steps which are settings for some kind of action or process that is done to a file. However, they all have lives of their own which means you can do some neat things with them.

Let's imagine that you have a module that needs to do some kind of file processing that Media Mover already supports. You can define a step- that is, a set of settings - much like a view - in code in your module. You can then invoke it simply:

$step = media_mover_api_step_get($step_id);
$step->run($file);

This allows for running conversions dynamically- changing settings for a step based on varying criteria, further abstracts Media Mover from the node context, and so on. Why would you want something like this? Imagine you have a document that you need to customize for users based on some data in a cck field. You can take this data, parse it in to a text file and then use Media Mover's Antiword module to generate a unique PDF for the end user. Another use case is in AJAX callbacks to display altered images or watermarks or what have you...