Use ProcessingState for video.
Rewrite video to use the new ProcessingState. Thanks to Joar Wandborg for testing!
This commit is contained in:
parent
e382792637
commit
bfd68cce85
@ -18,7 +18,6 @@ from tempfile import NamedTemporaryFile
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from mediagoblin import mg_globals as mgg
|
from mediagoblin import mg_globals as mgg
|
||||||
from mediagoblin.decorators import get_workbench
|
|
||||||
from mediagoblin.processing import \
|
from mediagoblin.processing import \
|
||||||
create_pub_filepath, FilenameBuilder, BaseProcessingFail, ProgressCallback
|
create_pub_filepath, FilenameBuilder, BaseProcessingFail, ProgressCallback
|
||||||
from mediagoblin.tools.translate import lazy_pass_to_ugettext as _
|
from mediagoblin.tools.translate import lazy_pass_to_ugettext as _
|
||||||
@ -52,8 +51,8 @@ def sniff_handler(media_file, **kw):
|
|||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@get_workbench
|
|
||||||
def process_video(entry, workbench=None):
|
def process_video(entry):
|
||||||
"""
|
"""
|
||||||
Process a video entry, transcode the queued media files (originals) and
|
Process a video entry, transcode the queued media files (originals) and
|
||||||
create a thumbnail for the entry.
|
create a thumbnail for the entry.
|
||||||
@ -61,12 +60,12 @@ def process_video(entry, workbench=None):
|
|||||||
A Workbench() represents a local tempory dir. It is automatically
|
A Workbench() represents a local tempory dir. It is automatically
|
||||||
cleaned up when this function exits.
|
cleaned up when this function exits.
|
||||||
"""
|
"""
|
||||||
|
proc_state = entry.proc_state
|
||||||
|
workbench = proc_state.workbench
|
||||||
video_config = mgg.global_config['media_type:mediagoblin.media_types.video']
|
video_config = mgg.global_config['media_type:mediagoblin.media_types.video']
|
||||||
|
|
||||||
queued_filepath = entry.queued_media_file
|
queued_filepath = entry.queued_media_file
|
||||||
queued_filename = workbench.localized_file(
|
queued_filename = proc_state.get_queued_filename()
|
||||||
mgg.queue_store, queued_filepath,
|
|
||||||
'source')
|
|
||||||
name_builder = FilenameBuilder(queued_filename)
|
name_builder = FilenameBuilder(queued_filename)
|
||||||
|
|
||||||
medium_filepath = create_pub_filepath(
|
medium_filepath = create_pub_filepath(
|
||||||
@ -121,4 +120,5 @@ def process_video(entry, workbench=None):
|
|||||||
mgg.public_store.copy_local_to_storage(queued_filename, original_filepath)
|
mgg.public_store.copy_local_to_storage(queued_filename, original_filepath)
|
||||||
entry.media_files['original'] = original_filepath
|
entry.media_files['original'] = original_filepath
|
||||||
|
|
||||||
mgg.queue_store.delete_file(queued_filepath)
|
# Remove queued media file from storage and database
|
||||||
|
proc_state.delete_queue_file()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user