self.delete_queue_file()
+class Resizer(CommonStlProcessor):
+ """
+ Resizing process steps for processed stls
+ """
+ name = 'resize'
+ description = 'Resize thumbnail and mediums'
+
+ @classmethod
+ def media_is_eligible(cls, entry=None, state=None):
+ """
+ Determine if this media type is eligible for processing
+ """
+ if not state:
+ state = entry.state
+ return state in 'processed'
+
+ @classmethod
+ def generate_parser(cls):
+ parser = argparse.ArgumentParser(
+ description=cls.description,
+ prog=cls.name)
+
+ parser.add_argument(
+ '--size',
+ nargs=2,
+ metavar=('max_width', 'max_height'),
+ type=int)
+
+ parser.add_argument(
+ 'file',
+ choices=['medium', 'thumb'])
+
+ return parser
+
+ @classmethod
+ def args_to_request(cls, args):
+ return request_from_args(
+ args, ['size', 'file'])
+
+ def process(self, file, size=None):
+ self.common_setup()
+ if file == 'medium':
+ self.generate_perspective(size=size)
+ self.generate_topview(size=size)
+ self.generate_frontview(size=size)
+ self.generate_sideview(size=size)
+ elif file == 'thumb':
+ self.generate_thumb(size=size)
+
+
class StlProcessingManager(ProcessingManager):
def __init__(self):
super(self.__class__, self).__init__()
self.add_processor(InitialProcessor)
+ self.add_processor(Resizer)