# copy it up!
store_public(self.entry, keyname, workbench_path, filename)
+ def _skip_processing(self, keyname, **kwargs):
+ file_metadata = self.entry.get_file_metadata(keyname)
+
+ if not file_metadata:
+ return False
+ skip = True
+
+ if keyname == 'thumb':
+ if kwargs.get('thumb_size') != file_metadata.get('thumb_size'):
+ skip = False
+ else:
+ if kwargs.get('size') != file_metadata.get('size'):
+ skip = False
+
+ return skip
+
def generate_thumb(self, thumb_size=None):
if not thumb_size:
thumb_size = (mgg.global_config['media:thumb']['max_width'],
mgg.global_config['media:thumb']['max_height'])
+ if self._skip_processing('thumb', thumb_size=thumb_size):
+ return
+
self._snap(
"thumb",
"{basename}.thumb.jpg",
thumb_size,
project="PERSP")
+ self.entry.set_file_metadata('thumb', thumb_size=thumb_size)
+
def generate_perspective(self, size=None):
if not size:
size = (mgg.global_config['media:medium']['max_width'],
mgg.global_config['media:medium']['max_height'])
+ if self._skip_processing('perspective', size=size):
+ return
+
self._snap(
"perspective",
"{basename}.perspective.jpg",
size,
project="PERSP")
+ self.entry.set_file_metadata('perspective', size=size)
+
def generate_topview(self, size=None):
if not size:
size = (mgg.global_config['media:medium']['max_width'],
mgg.global_config['media:medium']['max_height'])
+ if self._skip_processing('top', size=size):
+ return
+
self._snap(
"top",
"{basename}.top.jpg",
self.greatest*2],
size)
+ self.entry.set_file_metadata('top', size=size)
+
def generate_frontview(self, size=None):
if not size:
size = (mgg.global_config['media:medium']['max_width'],
mgg.global_config['media:medium']['max_height'])
+ if self._skip_processing('front', size=size):
+ return
+
self._snap(
"front",
"{basename}.front.jpg",
self.model.average[2]],
size)
+ self.entry.set_file_metadata('front', size=size)
+
def generate_sideview(self, size=None):
if not size:
size = (mgg.global_config['media:medium']['max_width'],
mgg.global_config['media:medium']['max_height'])
+ if self._skip_processing('side', size=size):
+ return
+
self._snap(
"side",
"{basename}.side.jpg",
self.model.average[2]],
size)
+ self.entry.set_file_metadata('side', size=size)
+
def store_dimensions(self):
"""
Put model dimensions into the database