docs: Fixed typo - missing closing bracket in link in api.rst
[mediagoblin.git] / docs / source / pluginwriter / media_type_hooks.rst
CommitLineData
91bee92e
RE
1==================
2 Media Type hooks
3==================
4
5This documents the hooks that are currently available for ``media_type`` plugins.
6
7What hooks are available?
8=========================
9
10'sniff_handler'
11---------------
12
13This hook is used by ``sniff_media`` in ``mediagoblin.media_types.__init__``.
14Your media type should return its ``sniff_media`` method when this hook is
15called.
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
24This hook is used by ``get_media_type_and_manager`` in
25``mediagoblin.media_types.__init__``. When this hook is called, your media type
26plugin should check if it can handle the given extension. If so, your media
27type plugin should return the media type and media manager.
2d0028e9
CAW
28
29('media_manager', MEDIA_TYPE)
30-----------------------------
31
32If you already know the string representing the media type of a type
33of media, you can pull down the manager specifically. Note that this
34hook is not a string but a tuple of two strings, the latter being the
35name of the media type.
36
37This is used by media entries to pull down their media managers, and
38so on.