def main(startpath): for root, dirs, files in os.walk(startpath): print "#", root for filenameraw in files: filename = re.sub('[^\x00-\x7f]+', '_', filenameraw) if filename.lower().endswith('jpeg') \ or filename.lower().endswith('jpg'): #or file.lower().endswith('tiff') \ #or file.lower().endswith('tif'): if 'mobotix' in filename or filename.startswith('.'): continue filepath = os.path.join(root, filenameraw) print filepath, filename try: print huimages.save_image( open(filepath).read(), timestamp=datetime.datetime.utcfromtimestamp( os.stat(filepath).st_mtime), title=filename, references={ 'path': re.sub('[^\x00-\x7f]+', '_', root) }, filename=filename) except Exception, msg: print "*error*", msg
def main(startpath): for root, dirs, files in os.walk(startpath): print "#", root for filenameraw in files: filename = re.sub('[^\x00-\x7f]+', '_', filenameraw) if filename.lower().endswith('jpeg') \ or filename.lower().endswith('jpg'): #or file.lower().endswith('tiff') \ #or file.lower().endswith('tif'): if 'mobotix' in filename or filename.startswith('.'): continue filepath = os.path.join(root, filenameraw) print filepath, filename try: print huimages.save_image(open(filepath).read(), timestamp=datetime.datetime.utcfromtimestamp(os.stat(filepath).st_mtime), title=filename, references={'path': re.sub('[^\x00-\x7f]+', '_', root)}, filename=filename) except Exception, msg: print "*error*", msg
def _put_file(self, name, content): """Put file on the server.""" if self.typ: return huimages.save_image(content, filename=name, typ=self.typ) return huimages.save_image(content, filename=name)