Multiple configs on same CCK FileField result in FileField link on node being replaced with first configs file.

rusirius - August 13, 2009 - 17:18
Project:Media Mover
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

I ran into an issue with a site I'm setting up using media mover. I ended up making a patch for the mm_cck.module and figured I'd post it up just in case someone else might run into the same issue.

So first, here's the problem... Imagine this scenario...

A site needs to allow a user to upload a video in various formats. Once the video is uploaded, three media mover configurations must act upon it.

1) It must be converted into a flash video (for preview using an xspf playlist and FLV player) {harvest CCK, store to local dir}

2) A thumbnail must be generated (against xspf playlist) {harvest CCK, store to local dir}

3) A Quicktime must be generated (for users to download in a standard broadcast quality format) {harvest CCK, store to local dir}

*note* Step two and three could be omitted, even it it was not there, if you wanted users to be able to download the "original" submitted file, you would still have this issue...

In this scenario, using Auto Run all the configs fire off after the user saves the node.

Three recordsets get added to the media_mover_files table. The very first one will be the flash video.

When a node with a CCK FileField is viewed, the CCK FileField is overridden with a media mover file link. However, because only the "first" recordset is pulled, the link will always be to the flash video (in this case).

You COULD just change the order over the configs, so that for example in this case the Quicktime file would be generated first, which would make the link be to it (which in this scenario is our goal), but that leads to other problems. If for some reason the Quicktime can't be generated you may want to fail over to the original file... If our thumbnail was the second file generated, then the link would be to it instead. Etc...

The solution I came up with and seems to work well at least for our purposes is to provide an "override" option for each configuration... It's an override of the override if you will... LOL...

This way, no matter how many configs you have, when the FileField is replaced it will ONLY be replaced with a link from a configuration which is NOT overridden... If you override all configs then the FileField link will stay pointing to the original uploaded file.

This patch is against the 6.x-1.x-dev version of mm_config.module.

Once put in place, under the "Settings" tab for media mover you will have a "CCK" section which will display any configurations you have created. Selecting any configuration will override it and prevent the filefield link from ever point to it's file.

Hope that all makes sense... Hard to explain...

AttachmentSize
mm_cck.module.patch2.95 KB
 
 

Drupal is a registered trademark of Dries Buytaert.