diff --git a/default.cfg b/default.cfg new file mode 100644 index 0000000..63fb555 --- /dev/null +++ b/default.cfg @@ -0,0 +1,21 @@ +[main] +# time source order +time_src = exif,name,attr + +# Date/Time formats +out_date_format = %%Y-%%m-%%d +out_time_format = %%Y-%%m-%%d_%%H-%%M-%%S + +# Output sub directorines +out_subdir_image = Foto +out_subdir_video = Video +out_subdir_audio = Audio + +# Thread count +threads_count = 2 + +# Remove garbage files (photo config, thumbnails, etc.) 0/1 +remove_garbage = 1 + +# Remove source files (in case of out_path specified) 0/1 +move_mode = 1 diff --git a/importer.py b/importer.py index 6a78e92..37f0344 100755 --- a/importer.py +++ b/importer.py @@ -15,6 +15,7 @@ class Importer(threading.Thread): self.__config = config self.__input_path = input_path self.__output_path = output_path + self.__mov = None self.__rot = None self.__stat = {'stage': ''} diff --git a/mover.py b/mover.py index b086ede..8a8b277 100755 --- a/mover.py +++ b/mover.py @@ -62,7 +62,7 @@ class Mover(object): if self.__output_path: type_subdir = \ self.__config['main'][self.OUT_SUBDIR_CFG[prop.type()]] - + date_subdir = prop.time().strftime( self.__config['main']['out_date_format']) diff --git a/run.py b/run.py index bb4e22e..2575a7c 100755 --- a/run.py +++ b/run.py @@ -1,8 +1,6 @@ #!/usr/bin/python3 -import sys import log -import time import argparse import threading import progressbar @@ -33,15 +31,15 @@ class ProgressBar(threading.Thread): def run(self): stage = '' while True: - time.sleep(0.1) stat = self.__imp.status() if stage != stat['stage']: stage = stat['stage'] if stage == 'scan': - print('Scan...') + print('Scan... ', end='', flush=True) continue if stage == 'move': + print('Done.') self.__create('Import:', stat['total']) continue if stage == 'rotate': @@ -58,16 +56,25 @@ class ProgressBar(threading.Thread): def args_parse(): parser = argparse.ArgumentParser() - parser.add_argument("echo", help="echo the string you use here") + parser.add_argument('in_path', help="Input path") + parser.add_argument('out_path', help="Output path", nargs='?') + parser.add_argument('-c', '--config', help="Config file") + parser.add_argument('-l', '--logfile', help="Log file", default='log.txt') return parser.parse_args() def main(): - # args = args_parse() + args = args_parse() - log.initLogger('log.txt') + cfg = config.Config(args.config) + + log.initLogger(args.logfile) + + imp = importer.Importer( + cfg, + args.in_path, + args.out_path) - imp = importer.Importer(config.Config(), sys.argv[1], sys.argv[2]) pbar = ProgressBar(imp) imp.start() pbar.start()