from mediagoblin.processing import (
BadMediaFail, FilenameBuilder,
MediaProcessor, ProcessingManager,
- request_from_args)
+ request_from_args, get_orig_filename)
from mediagoblin.submit.lib import run_process_media
from mediagoblin.tools.exif import exif_fix_image_orientation, \
extract_exif, clean_exif, get_gps_data, get_useful, \
help=(
"Height of the resized image (if not using defaults)"))
+ def setup_workbench_subdirs(self):
+ # Conversions subdirectory to avoid collisions
+ self.conversions_subdir = os.path.join(
+ self.workbench.dir, 'convirsions')
+
def fetch_original(self):
- pass
+ self.orig_filename = get_orig_filename(
+ self.entry, self.workbench)
+ self.name_builder = FilenameBuilder(self.orig_filename)
def generate_medium_if_applicable(self, size=None):
pass
def process(self, size=None, thumb_size=None):
+ self.setup_workbench_subdirs()
self.fetch_original()
self.generate_medium_if_applicable(size=size)
self.generate_thumb(size=thumb_size)
u'fail_metadata': {}})
+###############################################################################
+# refactoring procstate stuff here
+
+
+def get_orig_filename(entry, workbench):
+ """
+ Get the a filename for the original, on local storage
+
+ If the media entry has a queued_media_file, use that, otherwise
+ use the original.
+
+ In the future, this will return the highest quality file available
+ if neither the original or queued file are available by checking
+ some ordered list of preferred keys.
+ """
+ if entry.queued_media_file:
+ orig_filepath = entry.queued_media_file
+ storage = mgg.queue_store
+ else:
+ orig_filepath = entry.media_files['original']
+ storage = mgg.public_store
+
+ orig_filename = workbench.localized_file(
+ storage, orig_filepath,
+ 'source')
+
+ return orig_filename
+
+
+# end refactoring
+###############################################################################
+
+
+
class BaseProcessingFail(Exception):
"""
Base exception that all other processing failure messages should