from mediagoblin.media_types import sniff_media
from mediagoblin.plugins.api.tools import api_auth, get_entry_serializable, \
json_response
-from mediagoblin.submit.lib import prepare_entry, run_process_media
+from mediagoblin.submit.lib import prepare_queue_task, run_process_media
_log = logging.getLogger(__name__)
entry.generate_slug()
# queue appropriately
- queue_file = prepare_entry(request, entry, media_file.filename)
+ queue_file = prepare_queue_task(request.app, entry, media_file.filename)
with queue_file:
queue_file.write(request.files['file'].stream.read())
_log = logging.getLogger(__name__)
-def prepare_entry(request, entry, filename):
+def prepare_queue_task(app, entry, filename):
+ """
+ Prepare a MediaEntry for the processing queue and get a queue file
+ """
# We generate this ourselves so we know what the taks id is for
# retrieval later.
entry.queued_task_id = task_id
# Now store generate the queueing related filename
- queue_filepath = request.app.queue_store.get_unique_filepath(
+ queue_filepath = app.queue_store.get_unique_filepath(
['media_entries',
task_id,
secure_filename(filename)])
# queue appropriately
- queue_file = request.app.queue_store.get_file(
+ queue_file = app.queue_store.get_file(
queue_filepath, 'wb')
# Add queued filename to the entry
from mediagoblin.media_types import sniff_media, \
InvalidFileType, FileTypeNotSupported
from mediagoblin.submit.lib import handle_push_urls, run_process_media, \
- prepare_entry
+ prepare_queue_task
@require_active_login
# Generate a slug from the title
entry.generate_slug()
- queue_file = prepare_entry(request, entry, filename)
+ queue_file = prepare_queue_task(request.app, entry, filename)
with queue_file:
queue_file.write(request.files['file'].stream.read())