Merge remote-tracking branch 'joar/audio+sniffing'
Conflicts: mediagoblin/media_types/image/processing.py mediagoblin/media_types/video/__init__.py mediagoblin/media_types/video/processing.py mediagoblin/tests/test_submission.py
This commit is contained in:
@@ -20,7 +20,8 @@ from os.path import splitext
|
||||
from cgi import FieldStorage
|
||||
|
||||
from celery import registry
|
||||
import urllib,urllib2
|
||||
import urllib
|
||||
import urllib2
|
||||
import logging
|
||||
|
||||
_log = logging.getLogger(__name__)
|
||||
@@ -36,7 +37,7 @@ from mediagoblin.submit import forms as submit_forms
|
||||
from mediagoblin.processing import mark_entry_failed
|
||||
from mediagoblin.processing.task import 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
|
||||
|
||||
|
||||
@@ -56,7 +57,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()
|
||||
@@ -131,9 +136,10 @@ def submit_start(request):
|
||||
raise
|
||||
|
||||
if mg_globals.app_config["push_urls"]:
|
||||
feed_url=request.urlgen(
|
||||
feed_url = request.urlgen(
|
||||
'mediagoblin.user_pages.atom_feed',
|
||||
qualified=True,user=request.user.username)
|
||||
qualified=True,
|
||||
user=request.user.username)
|
||||
hubparameters = {
|
||||
'hub.mode': 'publish',
|
||||
'hub.url': feed_url}
|
||||
@@ -160,10 +166,9 @@ def submit_start(request):
|
||||
user=request.user.username)
|
||||
except Exception as e:
|
||||
'''
|
||||
This section is intended to catch exceptions raised in
|
||||
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(
|
||||
|
||||
Reference in New Issue
Block a user