diff options
Diffstat (limited to 'mediagoblin/processing')
-rw-r--r-- | mediagoblin/processing/__init__.py | 17 | ||||
-rw-r--r-- | mediagoblin/processing/task.py | 6 |
2 files changed, 21 insertions, 2 deletions
diff --git a/mediagoblin/processing/__init__.py b/mediagoblin/processing/__init__.py index f3a85940..bbe9f364 100644 --- a/mediagoblin/processing/__init__.py +++ b/mediagoblin/processing/__init__.py @@ -87,6 +87,7 @@ class ProcessingState(object): self.entry = entry self.workbench = None self.queued_filename = None + self.reprocess_filename = None def set_workbench(self, wb): self.workbench = wb @@ -128,6 +129,22 @@ class ProcessingState(object): mgg.queue_store.delete_dir(queued_filepath[:-1]) # rm dir self.entry.queued_media_file = [] + def get_reprocess_filename(self): + """ + Get the filename to use during reprocessing + """ + # Currently only returns the original file, but eventually will return + # the highest quality file if the original doesn't exist + if self.reprocess_filename is not None: + return self.reprocess_filename + + reprocess_filepath = self.entry.media_files['original'][2] + reprocess_filename = self.workbench.local_file( + mgg.public_store, reprocess_filepath, + 'original') + self.reprocess_filename = reprocess_filename + return reprocess_filename + def mark_entry_failed(entry_id, exc): """ diff --git a/mediagoblin/processing/task.py b/mediagoblin/processing/task.py index 9af192ed..c0dfb9b4 100644 --- a/mediagoblin/processing/task.py +++ b/mediagoblin/processing/task.py @@ -68,13 +68,15 @@ class ProcessMedia(task.Task): """ Pass this entry off for processing. """ - def run(self, media_id, feed_url): + def run(self, media_id, feed_url, reprocess_info=None): """ Pass the media entry off to the appropriate processing function (for now just process_image...) :param feed_url: The feed URL that the PuSH server needs to be updated for. + :param reprocess: A dict containing all of the necessary reprocessing + info for the media_type. """ entry = MediaEntry.query.get(media_id) @@ -89,7 +91,7 @@ class ProcessMedia(task.Task): with mgg.workbench_manager.create() as workbench: proc_state.set_workbench(workbench) # run the processing code - entry.media_manager.processor(proc_state) + entry.media_manager.processor(proc_state, reprocess_info) # We set the state to processed and save the entry here so there's # no need to save at the end of the processing stage, probably ;) |