aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/submit
diff options
context:
space:
mode:
authorJoar Wandborg <git@wandborg.com>2011-09-23 02:35:57 +0200
committerJoar Wandborg <git@wandborg.com>2011-09-23 02:35:57 +0200
commit93bdab9daad3ae431afd41a2efaefae05a555d88 (patch)
tree2586f778bbba650600c1d8a1480230e32a15bb34 /mediagoblin/submit
parent9122a9d047765574bb0d11436522a6c868da86cc (diff)
downloadmediagoblin-93bdab9daad3ae431afd41a2efaefae05a555d88.tar.lz
mediagoblin-93bdab9daad3ae431afd41a2efaefae05a555d88.tar.xz
mediagoblin-93bdab9daad3ae431afd41a2efaefae05a555d88.zip
Multimedia support - Commiting from a not yet finished state - Details below
* DONE Initially testing with arista ** DONE Video display templates *** TODO Multi-browser support ** TODO Video thumbnails ** TODO Link to original video ** TODO Video cropping Also contains a lot of "debug" print's
Diffstat (limited to 'mediagoblin/submit')
-rw-r--r--mediagoblin/submit/views.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/mediagoblin/submit/views.py b/mediagoblin/submit/views.py
index e24d78f3..78f52160 100644
--- a/mediagoblin/submit/views.py
+++ b/mediagoblin/submit/views.py
@@ -28,8 +28,9 @@ from mediagoblin.util import (
from mediagoblin.util import pass_to_ugettext as _
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
@@ -45,15 +46,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]))
@@ -62,7 +63,6 @@ def submit_start(request):
entry['description_html'] = cleaned_markdown_conversion(
entry['description'])
- entry['media_type'] = u'image' # heh
entry['uploader'] = request.user['_id']
# Process the user's folksonomy "tags"
@@ -72,6 +72,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',
@@ -103,7 +104,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: