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
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user