コード例 #1
0
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.")
コード例 #2
0
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.')
コード例 #3
0
        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())
コード例 #4
0
ファイル: fileprop.py プロジェクト: sashacmc/photo-importer
        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())