It would be great to store some extra audio fields in filefield meta. Namely file format, dataformat, bitrate mode, bitrate, channelmode and sample_rate.

Here is a patch that adds these fields to filefield meta ... hopefully I've created the patch properly.

Comments

dopry’s picture

Status: Active » Needs work

can you explain each column to me? and comment it in the patch... I'd prefer column names that adhere more closely to ffmpeg... format, audio_codec, audio_channels, audio_bitrate, video_codec, video_bitrate etc... at the very least prefix them with audio/video. cheers.

jdelaune’s picture

Version: 6.x-3.0-alpha4 » 6.x-3.0-alpha5
Status: Needs work » Needs review
StatusFileSize
new3.78 KB

Hey guys updated patrickharris's patch with dopry's recommendations. Hope this helps :)

drewish’s picture

Status: Needs review » Needs work

looks good but the one thing that jumps out at me is that we need an update function to create the new fields...

moonray’s picture

subscribing

jdelaune’s picture

Status: Needs work » Needs review
StatusFileSize
new6.35 KB

Never written a database update script. So this could be totally wrong, and I have no way of testing it.

moonray’s picture

Status: Needs review » Needs work

I tested the patch, and the only part not working properly is:

function filefield_update_1() {

should be:

function filefield_meta_update_1() {
jdelaune’s picture

Status: Needs work » Needs review
StatusFileSize
new6.35 KB

Sweet. Cheers mate.

moonray’s picture

Status: Needs review » Needs work

Ehm... that's exactly the same patch as before, no changes. Uploaded the wrong file?

jdelaune’s picture

Status: Needs work » Needs review
StatusFileSize
new6.36 KB

doh! lets try again...

moonray’s picture

Status: Needs review » Reviewed & tested by the community

Works for me. Thanks Starnox.

dopry’s picture

Status: Reviewed & tested by the community » Needs work

one more minor nit pick... width/height apply to both images and video... It can probably be kept as just width and height. other than that everything looks good.

moonray’s picture

Why are we not gathering all the id3 data from the audio file if it has it? Or would that be better done in a sub-module of filefield that deals specifically with audio files?

moonray’s picture

StatusFileSize
new4.31 KB

Updated patch incorporating comments from #11

moonray’s picture

Status: Needs work » Needs review
patrickharris’s picture

Moonray - yes, maybe the other id3 data should be stored as well (dopry said 'go to town' re adding in extra fields, so I guess he wouldn't mind). I really just included the fields I was most interested in, and they also happen to be the fields that audio module stores I think.

moonray’s picture

Audio module pulls out all the id3 info as well.

jdelaune’s picture

Hmm my only reserve in doing this is sometimes you would want to edit the ID3 data (like in the Audio module), so a separate sub-module of FileField to handle this data would be the best way forward IMO.

moonray’s picture

Agreed.
On the other hand, then you'd have to do a dual call to getid3 to get the info, no? Perhaps there needs to be a plug-in module for the WRITING part of the id3, but the READING part should be included in filefield_meta.

Thoughts?

dopry’s picture

Status: Needs review » Reviewed & tested by the community

@starnox: For now I only want a minimal amount of data in a denormalized table for filefield_meta... I'm working on a silghtly different schema for storing meta data thats more flexible... I really wanted a denormalized table for performance purposes, but for the long run probably will not work as well as I wanted and I wanted filefield_meta to contain a minimum of common media attributes, which is why all of the getID3 information isn't in there... If only mysql had a pivot function... If you really want to see more extensive changes, step up and write a patch instead of asking other people why they didn't scratch your itch. ;)

@moonray: I'll be doing commits one day this week... This is totally going in...

jdelaune’s picture

@dopry: I wasn't asking other people to do it? I didn't even think it was a good idea which is why I never rolled out a patch with it in. I'm quite capable of scratching my own itch thank-you, I'm using this current filefield_meta patch on my site and thought I would polish it up and commit it back with the changes you asked for. Sorry for helping out.

drewish’s picture

dopry, think you misread that one. i'd specifically asked starnox to submit back a patch after he'd mentioned some changes he'd made on irc.

dopry’s picture

Status: Reviewed & tested by the community » Fixed

committed to head. tnx.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.