# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+from mediagoblin.media_types import MediaManagerBase
from mediagoblin.media_types.ascii.processing import process_ascii, \
sniff_handler
-MEDIA_MANAGER = {
- "human_readable": "ASCII",
- "processor": process_ascii, # alternately a string,
- # 'mediagoblin.media_types.image.processing'?
- "sniff_handler": sniff_handler,
- "display_template": "mediagoblin/media_displays/ascii.html",
- "default_thumb": "images/media_thumbs/ascii.jpg",
- "accepted_extensions": [
- "txt", "asc", "nfo"]}
+class ASCIIMediaManager(MediaManagerBase):
+ human_readable = "ASCII"
+ processor = staticmethod(process_ascii)
+ sniff_handler = staticmethod(sniff_handler)
+ display_template = "mediagoblin/media_displays/ascii.html"
+ default_thumb = "images/media_thumbs/ascii.jpg"
+ accepted_extensions = ["txt", "asc", "nfo"]
+
+
+MEDIA_MANAGER = ASCIIMediaManager
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+from mediagoblin.media_types import MediaManagerBase
from mediagoblin.media_types.audio.processing import process_audio, \
sniff_handler
-MEDIA_MANAGER = {
- 'human_readable': 'Audio',
- 'processor': process_audio,
- 'sniff_handler': sniff_handler,
- 'display_template': 'mediagoblin/media_displays/audio.html',
- 'accepted_extensions': ['mp3', 'flac', 'wav', 'm4a']}
+
+class AudioMediaManager(MediaManagerBase):
+ human_readable = "Audio"
+ processor = staticmethod(process_audio)
+ sniff_handler = staticmethod(sniff_handler)
+ display_template = "mediagoblin/media_displays/audio.html"
+ accepted_extensions = ["mp3", "flac", "wav", "m4a"]
+
+
+MEDIA_MANAGER = AudioMediaManager
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+from mediagoblin.media_types import MediaManagerBase
from mediagoblin.media_types.pdf.processing import process_pdf, \
sniff_handler
-MEDIA_MANAGER = {
- "human_readable": "PDF",
- "processor": process_pdf, # alternately a string,
- # 'mediagoblin.media_types.image.processing'?
- "sniff_handler": sniff_handler,
- "display_template": "mediagoblin/media_displays/pdf.html",
- "default_thumb": "images/media_thumbs/pdf.jpg",
- "accepted_extensions": [
- "pdf"]}
+class PDFMediaManager(MediaManagerBase):
+ human_readable = "PDF"
+ processor = staticmethod(process_pdf)
+ sniff_handler = staticmethod(sniff_handler)
+ display_template = "mediagoblin/media_displays/pdf.html"
+ default_thumb = "images/media_thumbs/pdf.jpg"
+ accepted_extensions = ["pdf"]
+
+
+MEDIA_MANAGER = PDFMediaManager
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+from mediagoblin.media_types import MediaManagerBase
from mediagoblin.media_types.stl.processing import process_stl, \
sniff_handler
-MEDIA_MANAGER = {
- "human_readable": "stereo lithographics",
- "processor": process_stl,
- "sniff_handler": sniff_handler,
- "display_template": "mediagoblin/media_displays/stl.html",
- "default_thumb": "images/media_thumbs/video.jpg",
- "accepted_extensions": ["obj", "stl"]}
+class STLMediaManager(MediaManagerBase):
+ human_readable = "stereo lithographics"
+ processor = staticmethod(process_stl)
+ sniff_handler = staticmethod(sniff_handler)
+ display_template = "mediagoblin/media_displays/stl.html"
+ default_thumb = "images/media_thumbs/video.jpg"
+ accepted_extensions = ["obj", "stl"]
+
+
+MEDIA_MANGER = STLMediaManager
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+from mediagoblin.media_types import MediaManagerBase
from mediagoblin.media_types.video.processing import process_video, \
sniff_handler
-MEDIA_MANAGER = {
- "human_readable": "Video",
- "processor": process_video, # alternately a string,
- # 'mediagoblin.media_types.image.processing'?
- "sniff_handler": sniff_handler,
- "display_template": "mediagoblin/media_displays/video.html",
- "default_thumb": "images/media_thumbs/video.jpg",
- "accepted_extensions": [
- "mp4", "mov", "webm", "avi", "3gp", "3gpp", "mkv", "ogv", "m4v"],
-
+class VideoMediaManager(MediaManagerBase):
+ human_readable = "Video"
+ processor = staticmethod(process_video)
+ sniff_handler = staticmethod(sniff_handler)
+ display_template = "mediagoblin/media_displays/video.html"
+ default_thumb = "images/media_thumbs/video.jpg"
+ accepted_extensions = [
+ "mp4", "mov", "webm", "avi", "3gp", "3gpp", "mkv", "ogv", "m4v"]
+
# Used by the media_entry.get_display_media method
- "media_fetch_order": [u'webm_640', u'original'],
- "default_webm_type": 'video/webm; codecs="vp8, vorbis"',
-}
+ media_fetch_order = [u'webm_640', u'original']
+ default_webm_type = 'video/webm; codecs="vp8, vorbis"'
+
+
+MEDIA_MANAGER = VideoMediaManager