From: Rodney Ewing Date: Tue, 6 Aug 2013 17:48:26 +0000 (-0700) Subject: fix storage paramater in get_orig_filename(), fix __init__ for ProceessImage, better... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c541fb71f7f92ce13783400cf9b22083f38ae189;p=mediagoblin.git fix storage paramater in get_orig_filename(), fix __init__ for ProceessImage, better description for --size flag --- diff --git a/mediagoblin/media_types/image/__init__.py b/mediagoblin/media_types/image/__init__.py index 072611e7..68376f7f 100644 --- a/mediagoblin/media_types/image/__init__.py +++ b/mediagoblin/media_types/image/__init__.py @@ -34,7 +34,7 @@ def setup_plugin(): class ImageMediaManager(MediaManagerBase): human_readable = "Image" - processor = ProcessImage + processor = staticmethod(ProcessImage) display_template = "mediagoblin/media_displays/image.html" default_thumb = "images/media_thumbs/image.png" diff --git a/mediagoblin/media_types/image/processing.py b/mediagoblin/media_types/image/processing.py index 7ac3ac17..c97811b1 100644 --- a/mediagoblin/media_types/image/processing.py +++ b/mediagoblin/media_types/image/processing.py @@ -134,22 +134,23 @@ class ProcessImage(object): A Workbench() represents a local tempory dir. It is automatically cleaned up when this function exits. """ - def init(self, proc_state): - self.proc_state = proc_state - self.entry = proc_state.entry - self.workbench = proc_state.workbench + def __init__(self, proc_state=None): + if proc_state: + self.proc_state = proc_state + self.entry = proc_state.entry + self.workbench = proc_state.workbench - # Conversions subdirectory to avoid collisions - self.conversions_subdir = os.path.join( - self.workbench.dir, 'convirsions') + # Conversions subdirectory to avoid collisions + self.conversions_subdir = os.path.join( + self.workbench.dir, 'convirsions') - self.orig_filename = proc_state.get_orig_filename() - self.name_builder = FilenameBuilder(self.orig_filename) + self.orig_filename = proc_state.get_orig_filename() + self.name_builder = FilenameBuilder(self.orig_filename) - # Exif extraction - self.exif_tags = extract_exif(self.orig_filename) + # Exif extraction + self.exif_tags = extract_exif(self.orig_filename) - os.mkdir(self.conversions_subdir) + os.mkdir(self.conversions_subdir) def reprocess_action(self, args): """ @@ -174,6 +175,7 @@ class ProcessImage(object): parser.add_argument( '--size', nargs=2, + metavar=('max_width', 'max_height'), type=int) parser.add_argument( '--initial_processing', diff --git a/mediagoblin/processing/__init__.py b/mediagoblin/processing/__init__.py index 60565e09..5ce9281b 100644 --- a/mediagoblin/processing/__init__.py +++ b/mediagoblin/processing/__init__.py @@ -106,11 +106,13 @@ class ProcessingState(object): if self.entry.queued_media_file: orig_filepath = self.entry.queued_media_file + storage = mgg.queue_store else: orig_filepath = self.entry.media_files['original'] + storage = mgg.public_store orig_filename = self.workbench.localized_file( - mgg.queue_store, orig_filepath, + storage, orig_filepath, 'source') self.orig_filename = orig_filename return orig_filename