def main(): args = args_parse() cfg = config.Config(args.config) if args.logfile: logfile = args.logfile else: logfile = cfg['server']['log_file'] log.initLogger(logfile) try: server = PhotoImporterServer(cfg) logging.info("Photo importer server up.") server.serve_forever() except KeyboardInterrupt: server.socket.close() logging.info("Photo importer server down.")
def main(): args = args_parse() cfg = config.Config(args.config) log.initLogger(args.logfile) imp = importer.Importer(cfg, args.in_path, args.out_path, args.dryrun) pbar = ProgressBar(imp) imp.start() pbar.start() imp.join() pbar.join() status = imp.status() logging.info('status: %s' % str(status)) if status['move']['errors'] != 0 or status['rotate']['errors'] != 0: print('Some errors found. Please check log file.')
if line.startswith('processing '): ok = True else: ok = False error += line if error != '': logging.error('exiftran (%s) error: %s' % (filename, error)) except Exception as ex: logging.error('Rotator exception (%s): %s' % (filename, ex)) return ok def status(self): return { 'total': len(self.__filenames), 'processed': self.__processed, 'good': self.__good, 'errors': self.__errors } if __name__ == '__main__': import sys rot = Rotator(config.Config(), sys.argv[1:]) rot.run() print(rot.status())
for l, d in len_dirs: try: os.rmdir(d) logging.info('Removed: %s', d) except OSError: logging.info('Skipped: %s', d) def status(self): if self.__mov: self.__stat['move'] = self.__mov.status() if self.__rot: self.__stat['rotate'] = self.__rot.status() return self.__stat def log_text(self): return self.__log.get_text() if __name__ == '__main__': import sys log.initLogger() imp = Importer(config.Config(), sys.argv[1], sys.argv[2]) imp.start() imp.join() print(imp.status())
return self.__ok def path(self): return self.__path def ext(self): return self.__ext def out_name(self): return self.__out_name def out_name_full(self, path=None): if path is None: path = self.__path return self.__prop_ptr._out_name_full(path, self.__out_name, self.__ext) if __name__ == '__main__': import sys sys.path.insert(0, os.path.abspath('..')) from photo_importer import log from photo_importer import config log.initLogger(None, logging.DEBUG) fp = FileProp(config.Config()).get(sys.argv[1]) print(fp.type(), fp.time(), fp.ok())
def setUp(self): self.conf = config.Config() self.fp = fileprop.FileProp(self.conf)