I have an (architectural) problem with D7 and don't know what would be a good solution to it. Here is what I'm trying to do: I have an article with a sound sample attached to it. I thought it would be great to calculate sound sample duration and bitrate and store it somewhere in the database. What would be the proper place for that? I thought of node fields first, but number of sound samples for one article is not restricted and it seems I'll need to define a field with unlimited number of values to hold durations and then somehow match samples with their respective durations. Don't think it's a proper solution here. So what's the common practice in such cases?
2 Answers
You might want to look into the Media project which provides bundles for files and allows to add fields to them.
Another approach would be to use a module like Field collection which allows you to group a number of fields into a group that you can add as a field to another entity. That field can then have an unlimited amount of values which allows you to attach n fiels + meta information to your node.
-
thanks. Field Collection is actually better for my case despite the fact it is in beta (Media is an overkill and doesn't work well with Lightbox2 - there is already a fix for that though).– Ari LinnCommented Feb 29, 2012 at 11:57
Not a direct answer to your question, but in some minds, the best option is to leverage a library or module that already exists. In this case, you can use the getID3() module and associated PHP library for extracting metadata.