aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/processing/__init__.py
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2013-03-01 16:29:22 -0600
committerChristopher Allan Webber <cwebber@dustycloud.org>2013-03-01 16:29:22 -0600
commited6344009abb31326acabe95449aaa449f66f4b4 (patch)
tree03d65052d550b890074dde3c18857371be974f5c /mediagoblin/processing/__init__.py
parent5c754fdaeeddb1bbeff165bbecb77e33b75b3c7d (diff)
parentb7a3798e1806eb52a244088fb600376ff25e0de9 (diff)
downloadmediagoblin-ed6344009abb31326acabe95449aaa449f66f4b4.tar.lz
mediagoblin-ed6344009abb31326acabe95449aaa449f66f4b4.tar.xz
mediagoblin-ed6344009abb31326acabe95449aaa449f66f4b4.zip
Merge branch 'master' into joar-skip_transcoding
Conflicts: mediagoblin/config_spec.ini
Diffstat (limited to 'mediagoblin/processing/__init__.py')
-rw-r--r--mediagoblin/processing/__init__.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/mediagoblin/processing/__init__.py b/mediagoblin/processing/__init__.py
index e2bc1a13..f9445e28 100644
--- a/mediagoblin/processing/__init__.py
+++ b/mediagoblin/processing/__init__.py
@@ -74,6 +74,40 @@ class FilenameBuilder(object):
ext=self.ext)
+class ProcessingState(object):
+ def __init__(self, entry):
+ self.entry = entry
+ self.workbench = None
+ self.queued_filename = None
+
+ def set_workbench(self, wb):
+ self.workbench = wb
+
+ def get_queued_filename(self):
+ """
+ Get the a filename for the original, on local storage
+ """
+ if self.queued_filename is not None:
+ return self.queued_filename
+ queued_filepath = self.entry.queued_media_file
+ queued_filename = self.workbench.localized_file(
+ mgg.queue_store, queued_filepath,
+ 'source')
+ self.queued_filename = queued_filename
+ return queued_filename
+
+ def copy_original(self, target_name, keyname=u"original"):
+ target_filepath = create_pub_filepath(self.entry, target_name)
+ mgg.public_store.copy_local_to_storage(self.get_queued_filename(),
+ target_filepath)
+ self.entry.media_files[keyname] = target_filepath
+
+ def delete_queue_file(self):
+ queued_filepath = self.entry.queued_media_file
+ mgg.queue_store.delete_file(queued_filepath)
+ self.entry.queued_media_file = []
+
+
def mark_entry_failed(entry_id, exc):
"""
Mark a media entry as having failed in its conversion.