i've talked with q0rban about adding some hooks so other modules could see the tags before they're written and add/modify them, and then get a copy of the final tags that were saved.

i think it'd make sense to centralize it in a single hook, maybe hook_audioapi($op, $node)? the ops that come to mind would be something like a "before save" "after save". not sure if it make sense to distinguish between inserts and updates.

Comments

drewish’s picture

on place i think it'd be really useful is for people who want to write improved media browsers that do more searching/browsing based on the tags. thomaz had talked with me in email about writing an audio browser module he's written for 4.6 that would probably benefit from these hooks when it's ported to/rewritten for 4.7. i hope he doesn't mind if i paste in a bit from an email but i think it's very interesting:

Anyway, let's go further to another point. As I said before, I have a
browse/search module for drupal 4.6 but it is not proper written and not
independant enough. Yet, this browse engine uses more advanced features
like grouping spelling faults, caching data for a specific time, etc.
What I actually can do, is rewrite the browse/search engine as an
independant module with his own tables. Let's say those tables can be an
artist and title table (3 fields: id, name, soundex (for spelling
mistakes)) where the name is unique. That way, when you browse, search,
you do not have to 'group', because the tables are sort of indexed already.
Next, 3 other tables keeping the relation between the artist/title table
and the node table:
relation nid, artist id
relation nid, title id
relation nid, title id, artist id (with a unique combination of title
id, artist id).
So, as you might see, I'm just making index tables. But for my job this
is necessary, since I have more than 1.000.000 records. Grouping artist
names or titles in just one table is killing the server.
Besides just the artist and title, there is also the possibility to
index the other metadata.

moshe weitzman’s picture

Just a nit - please call this hook_audio() and not audioapi. the api suffix is a relic that we are nearly rid of. hook_comment, hook_taxonomy, hook_user are the new way

drewish’s picture

Title: add audio api hook » add hook_audio()

good call moshe

zirafa’s picture

how would this api then be called? module_invoke('audio', 'audio'......?

drewish’s picture

i was thinking more like: module_invoke_all('audio', $op, $node);

drewish’s picture

drewish’s picture

Status: Active » Closed (duplicate)

i'm going to mark this as a duplicate of http://drupal.org/node/33708 because that's got the patch that'll probably get committed.