aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/submit/views.py
diff options
context:
space:
mode:
authorJoar Wandborg <git@wandborg.com>2012-02-15 01:15:29 +0100
committerJoar Wandborg <git@wandborg.com>2012-02-15 01:15:29 +0100
commitec4261a449c11b015190bc90dd9ae828261065cd (patch)
treee0b0edd47f34c640597af76473d3dc0695cc671a /mediagoblin/submit/views.py
parent5a34a80d0a9d8a930d2a8c49f48d3fe08b60a237 (diff)
downloadmediagoblin-ec4261a449c11b015190bc90dd9ae828261065cd.tar.lz
mediagoblin-ec4261a449c11b015190bc90dd9ae828261065cd.tar.xz
mediagoblin-ec4261a449c11b015190bc90dd9ae828261065cd.zip
Changed media processing delegation to a 'sniffing' method
- Added sniff handlers to all media plugins All of them except audio returning False for ANYTHING at the moment.
Diffstat (limited to 'mediagoblin/submit/views.py')
-rw-r--r--mediagoblin/submit/views.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/mediagoblin/submit/views.py b/mediagoblin/submit/views.py
index cdd097ec..4fafe1e3 100644
--- a/mediagoblin/submit/views.py
+++ b/mediagoblin/submit/views.py
@@ -35,7 +35,7 @@ from mediagoblin.decorators import require_active_login
from mediagoblin.submit import forms as submit_forms, security
from mediagoblin.processing import mark_entry_failed, ProcessMedia
from mediagoblin.messages import add_message, SUCCESS
-from mediagoblin.media_types import get_media_type_and_manager, \
+from mediagoblin.media_types import sniff_media, \
InvalidFileType, FileTypeNotSupported
@@ -55,7 +55,11 @@ def submit_start(request):
else:
try:
filename = request.POST['file'].filename
- media_type, media_manager = get_media_type_and_manager(filename)
+
+ # Sniff the submitted media to determine which
+ # media plugin should handle processing
+ media_type, media_manager = sniff_media(
+ request.POST['file'])
# create entry and save in database
entry = request.db.MediaEntry()
@@ -164,7 +168,6 @@ def submit_start(request):
This section is intended to catch exceptions raised in
mediagobling.media_types
'''
-
if isinstance(e, InvalidFileType) or \
isinstance(e, FileTypeNotSupported):
submit_form.file.errors.append(