Archive for June, 2008

Harvest From Filesystem

I put together a module for Media Mover which allows some basic support for harvesting files from the local file system. It uses the same form that other Media Modules do- provides an absolute path to a directory and has a file extension filter. It currently does not work recursively, but it should be enough to provide the initial functionality.

Here you can see the options that the mm_dir module gives on a configuration screen:

The code is in CVS and will be released with the next Media Mover release.

See the discussion here: http://drupal.org/node/258956#comment-900776
UPDATE: now also supports storing to the filesystem as well.

Comments

Import / Export Configurations in Media Mover

One of the greatest things about the views project is that it is simple to create backups or move views from one site to another. It makes it really easy to entrust site administrators to develop complicated tools inside of Drupal without ever touching code. It’s also great for developers because we can put the views created by administrators of the site into code and actually keep track of critical views inside modules where things can be kept under version control.

Media Mover presents similar challenges for websites.You want to try out major changes before they go live- often on a different server or at least a different environment from your live one. You don’t want to bog down your server with extra processing until you know for sure you’ve got things right. Further, it gives you a chance to test out different configurations of processing to tweak the final output for your ends.

The problem however, is moving those configurations from one environment to another. It’s not that hard to do this by hand, but there is room for error, and doing lots of this can get tiresome very quickly.

I sat down this morning and started shelling out the import / export system for Media Mover. At the moment, it’s quite simple and doesn’t allow the defining of configurations in other modules, however, that should be fairly easy to implement. What it does do is straight forward exporting of an existing configuration and importing of the same configuration. The only real error checking that it does is to make sure that the same models are enabled on the import- this prevents some potentially nasty things from happening since there isn’t a whole lot of error checking once Media Mover starts processing.


The GUI is similar to views- clicking on the main export button gives you the options of which configurations to output, there is also a single link from the configuration landing page which directly exports that configuration.

That’s the extent of the export functionality. Once the user has the code, they can paste this code into the import textarea:

The code is basically the configuration object re-rendered in a textarea. Again, very similar to the approach taken by views:

In this final image, you can see the new view. I renamed it in the code so that it would have a new name on import just to make it obvious- by default this doesn’t happen, it’s just for demonstration purposes. If you’re interested in checking it out, take a peek at the DRUPAL-5 CVS branch. All the code is there.

Comments