From 02f04b9cb5c10c12b9ecea516d99672b946ae225 Mon Sep 17 00:00:00 2001
From: Praveen Kumar <praveen97uma@gmail.com>
Date: Mon, 29 Apr 2013 05:45:05 +0530
Subject: [PATCH] Make all media types use the new MediaManager classes.
---
mediagoblin/media_types/ascii/__init__.py | 20 +++++++++++---------
mediagoblin/media_types/audio/__init__.py | 17 +++++++++++------
mediagoblin/media_types/pdf/__init__.py | 20 +++++++++++---------
mediagoblin/media_types/stl/__init__.py | 18 +++++++++++-------
mediagoblin/media_types/video/__init__.py | 28 +++++++++++++++-------------
5 files changed, 59 insertions(+), 44 deletions(-)
diff --git a/mediagoblin/media_types/ascii/__init__.py b/mediagoblin/media_types/ascii/__init__.py
index 856d1d7..0931e83 100644
a
|
b
|
|
14 | 14 | # You should have received a copy of the GNU Affero General Public License |
15 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 | |
| 17 | from mediagoblin.media_types import MediaManagerBase |
17 | 18 | from mediagoblin.media_types.ascii.processing import process_ascii, \ |
18 | 19 | sniff_handler |
19 | 20 | |
20 | 21 | |
21 | | MEDIA_MANAGER = { |
22 | | "human_readable": "ASCII", |
23 | | "processor": process_ascii, # alternately a string, |
24 | | # 'mediagoblin.media_types.image.processing'? |
25 | | "sniff_handler": sniff_handler, |
26 | | "display_template": "mediagoblin/media_displays/ascii.html", |
27 | | "default_thumb": "images/media_thumbs/ascii.jpg", |
28 | | "accepted_extensions": [ |
29 | | "txt", "asc", "nfo"]} |
| 22 | class ASCIIMediaManager(MediaManagerBase): |
| 23 | human_readable = "ASCII" |
| 24 | processor = staticmethod(process_ascii) |
| 25 | sniff_handler = staticmethod(sniff_handler) |
| 26 | display_template = "mediagoblin/media_displays/ascii.html" |
| 27 | default_thumb = "images/media_thumbs/ascii.jpg" |
| 28 | accepted_extensions = ["txt", "asc", "nfo"] |
| 29 | |
| 30 | |
| 31 | MEDIA_MANAGER = ASCIIMediaManager |
diff --git a/mediagoblin/media_types/audio/__init__.py b/mediagoblin/media_types/audio/__init__.py
index 4f3ead6..2eb7300 100644
a
|
b
|
|
14 | 14 | # You should have received a copy of the GNU Affero General Public License |
15 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 | |
| 17 | from mediagoblin.media_types import MediaManagerBase |
17 | 18 | from mediagoblin.media_types.audio.processing import process_audio, \ |
18 | 19 | sniff_handler |
19 | 20 | |
20 | | MEDIA_MANAGER = { |
21 | | 'human_readable': 'Audio', |
22 | | 'processor': process_audio, |
23 | | 'sniff_handler': sniff_handler, |
24 | | 'display_template': 'mediagoblin/media_displays/audio.html', |
25 | | 'accepted_extensions': ['mp3', 'flac', 'wav', 'm4a']} |
| 21 | |
| 22 | class AudioMediaManager(MediaManagerBase): |
| 23 | human_readable = "Audio" |
| 24 | processor = staticmethod(process_audio) |
| 25 | sniff_handler = staticmethod(sniff_handler) |
| 26 | display_template = "mediagoblin/media_displays/audio.html" |
| 27 | accepted_extensions = ["mp3", "flac", "wav", "m4a"] |
| 28 | |
| 29 | |
| 30 | MEDIA_MANAGER = AudioMediaManager |
diff --git a/mediagoblin/media_types/pdf/__init__.py b/mediagoblin/media_types/pdf/__init__.py
index a6d23c9..f0ba786 100644
a
|
b
|
|
14 | 14 | # You should have received a copy of the GNU Affero General Public License |
15 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 | |
| 17 | from mediagoblin.media_types import MediaManagerBase |
17 | 18 | from mediagoblin.media_types.pdf.processing import process_pdf, \ |
18 | 19 | sniff_handler |
19 | 20 | |
20 | 21 | |
21 | | MEDIA_MANAGER = { |
22 | | "human_readable": "PDF", |
23 | | "processor": process_pdf, # alternately a string, |
24 | | # 'mediagoblin.media_types.image.processing'? |
25 | | "sniff_handler": sniff_handler, |
26 | | "display_template": "mediagoblin/media_displays/pdf.html", |
27 | | "default_thumb": "images/media_thumbs/pdf.jpg", |
28 | | "accepted_extensions": [ |
29 | | "pdf"]} |
| 22 | class PDFMediaManager(MediaManagerBase): |
| 23 | human_readable = "PDF" |
| 24 | processor = staticmethod(process_pdf) |
| 25 | sniff_handler = staticmethod(sniff_handler) |
| 26 | display_template = "mediagoblin/media_displays/pdf.html" |
| 27 | default_thumb = "images/media_thumbs/pdf.jpg" |
| 28 | accepted_extensions = ["pdf"] |
| 29 | |
| 30 | |
| 31 | MEDIA_MANAGER = PDFMediaManager |
diff --git a/mediagoblin/media_types/stl/__init__.py b/mediagoblin/media_types/stl/__init__.py
index edffc63..b691e43 100644
a
|
b
|
|
14 | 14 | # You should have received a copy of the GNU Affero General Public License |
15 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 | |
| 17 | from mediagoblin.media_types import MediaManagerBase |
17 | 18 | from mediagoblin.media_types.stl.processing import process_stl, \ |
18 | 19 | sniff_handler |
19 | 20 | |
20 | 21 | |
21 | | MEDIA_MANAGER = { |
22 | | "human_readable": "stereo lithographics", |
23 | | "processor": process_stl, |
24 | | "sniff_handler": sniff_handler, |
25 | | "display_template": "mediagoblin/media_displays/stl.html", |
26 | | "default_thumb": "images/media_thumbs/video.jpg", |
27 | | "accepted_extensions": ["obj", "stl"]} |
| 22 | class STLMediaManager(MediaManagerBase): |
| 23 | human_readable = "stereo lithographics" |
| 24 | processor = staticmethod(process_stl) |
| 25 | sniff_handler = staticmethod(sniff_handler) |
| 26 | display_template = "mediagoblin/media_displays/stl.html" |
| 27 | default_thumb = "images/media_thumbs/video.jpg" |
| 28 | accepted_extensions = ["obj", "stl"] |
| 29 | |
| 30 | |
| 31 | MEDIA_MANGER = STLMediaManager |
diff --git a/mediagoblin/media_types/video/__init__.py b/mediagoblin/media_types/video/__init__.py
index fab601f..569cf11 100644
a
|
b
|
|
14 | 14 | # You should have received a copy of the GNU Affero General Public License |
15 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 | |
| 17 | from mediagoblin.media_types import MediaManagerBase |
17 | 18 | from mediagoblin.media_types.video.processing import process_video, \ |
18 | 19 | sniff_handler |
19 | 20 | |
20 | 21 | |
21 | | MEDIA_MANAGER = { |
22 | | "human_readable": "Video", |
23 | | "processor": process_video, # alternately a string, |
24 | | # 'mediagoblin.media_types.image.processing'? |
25 | | "sniff_handler": sniff_handler, |
26 | | "display_template": "mediagoblin/media_displays/video.html", |
27 | | "default_thumb": "images/media_thumbs/video.jpg", |
28 | | "accepted_extensions": [ |
29 | | "mp4", "mov", "webm", "avi", "3gp", "3gpp", "mkv", "ogv", "m4v"], |
30 | | |
| 22 | class VideoMediaManager(MediaManagerBase): |
| 23 | human_readable = "Video" |
| 24 | processor = staticmethod(process_video) |
| 25 | sniff_handler = staticmethod(sniff_handler) |
| 26 | display_template = "mediagoblin/media_displays/video.html" |
| 27 | default_thumb = "images/media_thumbs/video.jpg" |
| 28 | accepted_extensions = [ |
| 29 | "mp4", "mov", "webm", "avi", "3gp", "3gpp", "mkv", "ogv", "m4v"] |
| 30 | |
31 | 31 | # Used by the media_entry.get_display_media method |
32 | | "media_fetch_order": [u'webm_640', u'original'], |
33 | | "default_webm_type": 'video/webm; codecs="vp8, vorbis"', |
34 | | } |
| 32 | media_fetch_order = [u'webm_640', u'original'] |
| 33 | default_webm_type = 'video/webm; codecs="vp8, vorbis"' |
| 34 | |
| 35 | |
| 36 | MEDIA_MANAGER = VideoMediaManager |