Make all media types use the new MediaManager classes.

This commit is contained in:
Praveen Kumar 2013-04-29 05:45:05 +05:30 committed by Elrond
parent b835e15319
commit 761389507d
5 changed files with 59 additions and 44 deletions

View File

@ -14,16 +14,18 @@
# You should have received a copy of the GNU Affero General Public License # 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/>. # 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, \ from mediagoblin.media_types.ascii.processing import process_ascii, \
sniff_handler sniff_handler
MEDIA_MANAGER = { class ASCIIMediaManager(MediaManagerBase):
"human_readable": "ASCII", human_readable = "ASCII"
"processor": process_ascii, # alternately a string, processor = staticmethod(process_ascii)
# 'mediagoblin.media_types.image.processing'? sniff_handler = staticmethod(sniff_handler)
"sniff_handler": sniff_handler, display_template = "mediagoblin/media_displays/ascii.html"
"display_template": "mediagoblin/media_displays/ascii.html", default_thumb = "images/media_thumbs/ascii.jpg"
"default_thumb": "images/media_thumbs/ascii.jpg", accepted_extensions = ["txt", "asc", "nfo"]
"accepted_extensions": [
"txt", "asc", "nfo"]}
MEDIA_MANAGER = ASCIIMediaManager

View File

@ -14,12 +14,17 @@
# You should have received a copy of the GNU Affero General Public License # 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/>. # 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, \ from mediagoblin.media_types.audio.processing import process_audio, \
sniff_handler sniff_handler
MEDIA_MANAGER = {
'human_readable': 'Audio', class AudioMediaManager(MediaManagerBase):
'processor': process_audio, human_readable = "Audio"
'sniff_handler': sniff_handler, processor = staticmethod(process_audio)
'display_template': 'mediagoblin/media_displays/audio.html', sniff_handler = staticmethod(sniff_handler)
'accepted_extensions': ['mp3', 'flac', 'wav', 'm4a']} display_template = "mediagoblin/media_displays/audio.html"
accepted_extensions = ["mp3", "flac", "wav", "m4a"]
MEDIA_MANAGER = AudioMediaManager

View File

@ -14,16 +14,18 @@
# You should have received a copy of the GNU Affero General Public License # 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/>. # 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, \ from mediagoblin.media_types.pdf.processing import process_pdf, \
sniff_handler sniff_handler
MEDIA_MANAGER = { class PDFMediaManager(MediaManagerBase):
"human_readable": "PDF", human_readable = "PDF"
"processor": process_pdf, # alternately a string, processor = staticmethod(process_pdf)
# 'mediagoblin.media_types.image.processing'? sniff_handler = staticmethod(sniff_handler)
"sniff_handler": sniff_handler, display_template = "mediagoblin/media_displays/pdf.html"
"display_template": "mediagoblin/media_displays/pdf.html", default_thumb = "images/media_thumbs/pdf.jpg"
"default_thumb": "images/media_thumbs/pdf.jpg", accepted_extensions = ["pdf"]
"accepted_extensions": [
"pdf"]}
MEDIA_MANAGER = PDFMediaManager

View File

@ -14,14 +14,18 @@
# You should have received a copy of the GNU Affero General Public License # 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/>. # 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, \ from mediagoblin.media_types.stl.processing import process_stl, \
sniff_handler sniff_handler
MEDIA_MANAGER = { class STLMediaManager(MediaManagerBase):
"human_readable": "stereo lithographics", human_readable = "stereo lithographics"
"processor": process_stl, processor = staticmethod(process_stl)
"sniff_handler": sniff_handler, sniff_handler = staticmethod(sniff_handler)
"display_template": "mediagoblin/media_displays/stl.html", display_template = "mediagoblin/media_displays/stl.html"
"default_thumb": "images/media_thumbs/video.jpg", default_thumb = "images/media_thumbs/video.jpg"
"accepted_extensions": ["obj", "stl"]} accepted_extensions = ["obj", "stl"]
MEDIA_MANGER = STLMediaManager

View File

@ -14,21 +14,23 @@
# You should have received a copy of the GNU Affero General Public License # 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/>. # 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, \ from mediagoblin.media_types.video.processing import process_video, \
sniff_handler sniff_handler
MEDIA_MANAGER = { class VideoMediaManager(MediaManagerBase):
"human_readable": "Video", human_readable = "Video"
"processor": process_video, # alternately a string, processor = staticmethod(process_video)
# 'mediagoblin.media_types.image.processing'? sniff_handler = staticmethod(sniff_handler)
"sniff_handler": sniff_handler, display_template = "mediagoblin/media_displays/video.html"
"display_template": "mediagoblin/media_displays/video.html", default_thumb = "images/media_thumbs/video.jpg"
"default_thumb": "images/media_thumbs/video.jpg", accepted_extensions = [
"accepted_extensions": [ "mp4", "mov", "webm", "avi", "3gp", "3gpp", "mkv", "ogv", "m4v"]
"mp4", "mov", "webm", "avi", "3gp", "3gpp", "mkv", "ogv", "m4v"],
# Used by the media_entry.get_display_media method # Used by the media_entry.get_display_media method
"media_fetch_order": [u'webm_640', u'original'], media_fetch_order = [u'webm_640', u'original']
"default_webm_type": 'video/webm; codecs="vp8, vorbis"', default_webm_type = 'video/webm; codecs="vp8, vorbis"'
}
MEDIA_MANAGER = VideoMediaManager