Commit | Line | Data |
---|---|---|
91bee92e RE |
1 | ================== |
2 | Media Type hooks | |
3 | ================== | |
4 | ||
5 | This documents the hooks that are currently available for ``media_type`` plugins. | |
6 | ||
7 | What hooks are available? | |
8 | ========================= | |
9 | ||
10 | 'sniff_handler' | |
11 | --------------- | |
12 | ||
13 | This hook is used by ``sniff_media`` in ``mediagoblin.media_types.__init__``. | |
14 | Your media type should return its ``sniff_media`` method when this hook is | |
15 | called. | |
16 | ||
17 | .. Note:: | |
18 | Your ``sniff_media`` method should return either the ``media_type`` or | |
19 | ``None``. | |
20 | ||
21 | 'get_media_type_and_manager' | |
22 | ---------------------------- | |
23 | ||
24 | This hook is used by ``get_media_type_and_manager`` in | |
25 | ``mediagoblin.media_types.__init__``. When this hook is called, your media type | |
26 | plugin should check if it can handle the given extension. If so, your media | |
27 | type plugin should return the media type and media manager. | |
2d0028e9 CAW |
28 | |
29 | ('media_manager', MEDIA_TYPE) | |
30 | ----------------------------- | |
31 | ||
32 | If you already know the string representing the media type of a type | |
33 | of media, you can pull down the manager specifically. Note that this | |
34 | hook is not a string but a tuple of two strings, the latter being the | |
35 | name of the media type. | |
36 | ||
37 | This is used by media entries to pull down their media managers, and | |
38 | so on. |