diff --git a/handle_imported_video.py b/handle_imported_video.py index c3a41d4..04b6722 100644 --- a/handle_imported_video.py +++ b/handle_imported_video.py @@ -8,11 +8,6 @@ import shutil import json import getopt -#_SOURCE_DIR = "/media/nas/nas-photo/imported/" -_SOURCE_DIR = "/share/Photo/imported/" -_DEV = "gopro9_1" -_DAY_DIR = "2022-08-04 - Bukovec-Jano" -_FULL_PATH = _SOURCE_DIR + "/" + _DEV + "/" + _DAY_DIR try: opts, args = getopt.getopt(sys.argv[1:], "hbl:o:s:t:", ["command=", "help", "output=", "backup"]) @@ -23,25 +18,28 @@ except getopt.GetoptError as err: sys.exit(2) output = None # QJ : getopts - +_DEV = "gopro9_1" +_SEQUENCES = [] for o, a in opts: if o == "-h": _ACTION = True - elif o in ("-b", "--backup"): - _BACKUP = True - elif o in ("-l", "--level"): - _LOG_LEVEL = a.upper() - elif o in ("-o", "--output"): - OUTPUT_FILE = a - elif o in ("-s", "--schema"): - SCHEMA = a - elif o in ("-t", "--tables"): - TABLES = a + elif o in ("-d", "--device"): + _DEV = True + elif o in ("-p", "--part"): + _DAY_DIR = a + elif o in ("-s", "--sequence"): + a = a.split(",") + for s in a: + _SEQUENCES.append("{:04d}".format(a)) else: _WIZZARD = True - +#_SOURCE_DIR = "/media/nas/nas-photo/imported/" +_SOURCE_DIR = "/share/Photo/imported/" +_FULL_PATH = _SOURCE_DIR + "/" + _DEV + "/" + _DAY_DIR +_PROCESSED = _FULL_PATH +"/processed" + video_seq = {} if os.path.exists(_FULL_PATH): for filename in os.listdir(_FULL_PATH): @@ -55,8 +53,12 @@ if os.path.exists(_FULL_PATH): print(seq) print(part) print(json.dumps(video_seq,indent=2)) - + os.mkdir(_PROCESSED) + print(_SEQUENCES) for vid in video_seq: + + if len(_SEQUENCES) != 0 and vid not in _SEQUENCES: + continue export_name = "joined_" + vid + ".MP4" parts = video_seq[vid] parts.sort() @@ -87,4 +89,6 @@ if os.path.exists(_FULL_PATH): print(myCmd) print(os.getcwd()) status, output = subprocess.getstatusoutput(myCmd) - print(output) \ No newline at end of file + print(output) + for p in parts: + shutil.move(p, _PROCESSED) \ No newline at end of file