Add new hook for two-step media type checking
authorBoris Bobrov <breton@cynicmansion.ru>
Sun, 27 Jul 2014 03:25:14 +0000 (07:25 +0400)
committerBoris Bobrov <breton@cynicmansion.ru>
Mon, 16 Feb 2015 10:41:09 +0000 (13:41 +0300)
commit54b4b28f84444a5b4e95eca0c2ca6429d52573c3
treea9b93e8af396a5dfc150dfc2ee929885d5535935
parent067ee131885c2c3df88cb75e1c41a33d6681752f
Add new hook for two-step media type checking

Before uploaded media files were checked by extension. This led to
situations when a plugin can support file with specific extension but
doesn't due to lack of codecs, for example. Since the plugin reported
that it supports uploaded file type, the upload was being declared
successful, but transcoding failed.

The failures were not easy to debug.

The change adds a new hook that could allow two-step checking of the
content. The result of the hook execution returns a tuple with
media type name, manager and a callable sniffer, that can be used to
perform probably expensive checks of the content.

Also the change adds implementation of the hook for video.
mediagoblin/media_types/__init__.py
mediagoblin/media_types/tools.py
mediagoblin/media_types/video/__init__.py
mediagoblin/media_types/video/processing.py
mediagoblin/plugins/api/views.py
mediagoblin/submit/views.py