aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/submit/views.py
diff options
context:
space:
mode:
authorJoar Wandborg <git@wandborg.com>2011-11-21 21:51:30 +0100
committerJoar Wandborg <git@wandborg.com>2011-11-21 21:51:30 +0100
commitb9e1fa280edfff4daf424bbcf51bd651ed00f411 (patch)
tree9f373c6443874bc5542115a79860da5957a1e182 /mediagoblin/submit/views.py
parente56e5f8c5c3dc7909aa68a1543ed04ddb18e27f6 (diff)
parentc875bb74a8245b39b6985f37cb8ab838c22efa7e (diff)
downloadmediagoblin-b9e1fa280edfff4daf424bbcf51bd651ed00f411.tar.lz
mediagoblin-b9e1fa280edfff4daf424bbcf51bd651ed00f411.tar.xz
mediagoblin-b9e1fa280edfff4daf424bbcf51bd651ed00f411.zip
Merge branch 'video_gstreamer-only'
Conflicts: mediagoblin/db/migrations.py mediagoblin/submit/views.py
Diffstat (limited to 'mediagoblin/submit/views.py')
-rw-r--r--mediagoblin/submit/views.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/mediagoblin/submit/views.py b/mediagoblin/submit/views.py
index 139b1d1d..dd1c3d1b 100644
--- a/mediagoblin/submit/views.py
+++ b/mediagoblin/submit/views.py
@@ -27,8 +27,9 @@ from mediagoblin.tools.translate import pass_to_ugettext as _
from mediagoblin.tools.response import render_to_response, redirect
from mediagoblin.decorators import require_active_login
from mediagoblin.submit import forms as submit_forms, security
-from mediagoblin.process_media import process_media, mark_entry_failed
+from mediagoblin.process_media import mark_entry_failed
from mediagoblin.messages import add_message, SUCCESS
+from mediagoblin.media_types import get_media_type_and_manager
@require_active_login
@@ -44,15 +45,15 @@ def submit_start(request):
and request.POST['file'].file):
submit_form.file.errors.append(
_(u'You must provide a file.'))
- elif not security.check_filetype(request.POST['file']):
- submit_form.file.errors.append(
- _(u"The file doesn't seem to be an image!"))
else:
filename = request.POST['file'].filename
+ media_type, media_manager = get_media_type_and_manager(filename)
+
# create entry and save in database
entry = request.db.MediaEntry()
entry['_id'] = ObjectId()
+ entry['media_type'] = unicode(media_type)
entry['title'] = (
unicode(request.POST['title'])
or unicode(splitext(filename)[0]))
@@ -60,9 +61,8 @@ def submit_start(request):
entry['description'] = unicode(request.POST.get('description'))
entry['description_html'] = cleaned_markdown_conversion(
entry['description'])
-
- entry['media_type'] = u'image' # heh
- entry['uploader'] = request.user._id
+
+ entry['uploader'] = request.user['_id']
# Process the user's folksonomy "tags"
entry['tags'] = convert_to_tag_list_of_dicts(
@@ -71,6 +71,7 @@ def submit_start(request):
# Generate a slug from the title
entry.generate_slug()
+
# Now store generate the queueing related filename
queue_filepath = request.app.queue_store.get_unique_filepath(
['media_entries',
@@ -104,7 +105,7 @@ def submit_start(request):
# (... don't change entry after this point to avoid race
# conditions with changes to the document via processing code)
try:
- process_media.apply_async(
+ media_manager['processor'].apply_async(
[unicode(entry._id)], {},
task_id=task_id)
except BaseException as exc: