From 9071c8a3c0f3c21bd9885023c0039b51e7e5aeaf Mon Sep 17 00:00:00 2001 From: jaydee Date: Tue, 17 Jun 2025 19:24:39 +0200 Subject: [PATCH] build --- handle_imported_video.py | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/handle_imported_video.py b/handle_imported_video.py index 662c76d..c29807f 100644 --- a/handle_imported_video.py +++ b/handle_imported_video.py @@ -76,17 +76,22 @@ for o, a in opts: #print(_FULL_PATH) -if _ACTION == "flip": + +def flip_videos(_DEV,_SOURCE_DIR,_DAY_DIRS): + for _DAY_DIR in _DAY_DIRS: if ops == "win": _FULL_PATH = _SOURCE_DIR + "\\" + _DEV + "\\" + _DAY_DIR + "\\" else: _FULL_PATH = _SOURCE_DIR + "/" + _DEV + "/" + _DAY_DIR + "/" + + os.chdir(_FULL_PATH) for filename in os.listdir(_FULL_PATH): - FPATH = _FULL_PATH + filename - print(FPATH) if filename.endswith(".MP4") and not filename.startswith("joined_"): + + + create_date = filedate.File(filename).get() print(filename) export_name = 'flipped_' + filename if ops == "win": @@ -94,15 +99,18 @@ if _ACTION == "flip": "ffmpeg", "-i", filename ,"-c", "copy", "-metadata:s:v:0", "rotate=180", "-y", export_name ] else: - myCmd = [ - "/usr/bin/ffmpeg", "-i", filename, "-c", "copy", "-metadata:s:v:0", "rotate=180", "-y", export_name - ] + # myCmd = [ + # "/usr/bin/ffmpeg", "-i", filename, "-c", "copy", "-metadata:s:v:0", "rotate=180", "-y", export_name + # ] # myCmd = [ # "/usr/bin/ffmpeg", "-i", filename, "-vf", "transpose=2,transpose=2", "-y", export_name # ] # myCmd = [ - # "/usr/bin/ffmpeg", "-i", filename, "-vf", "hflip", "-c:a", "copy", "-y", export_name + # "/usr/bin/ffmpeg", "-i", filename, "-vf", "hflip", "-c:a", "-codec", "copy", "-y", export_name # ] + myCmd = [ + "exiftool", "-rotation=180", filename + ] #Path = "~/Documents/File.txt" # filedate.File(Path).set( @@ -110,14 +118,12 @@ if _ACTION == "flip": # modified = "3:00 PM, 04 May 2009", # accessed = "08/07/2014 18:30:45" # ) - os.chdir(_FULL_PATH) - create_date = filedate.File(filename).get() if _TEST: print(_FULL_PATH) print(myCmd) print(myCmd) proc = subprocess.Popen(myCmd,stdout=subprocess.DEVNULL,stderr=subprocess.STDOUT) - print(f"Fliping {filename} to {export_name} in {_DAY_DIR}...".ljust(100)) + print(f"Fliping {filename} in {_DAY_DIR}...".ljust(100)) ff = FfmpegProgress(myCmd) with tqdm(total=100, position=1, desc="Fliping") as pbar: for progress in ff.run_command_with_progress(): @@ -129,10 +135,10 @@ if _ACTION == "flip": #print(ff.stderr) #ffmpeg -i .\GH010149.MP4 -c:v hevc_amf -rc cqp -qp_i 42 -qp_p 42 -quality quality -crf 25 output7.mp4 try: - shutil.move(export_name, "__" + export_name) - shutil.move(export_name, export_name) + # shutil.move(filename, "__" + export_name) + # shutil.move(export_name, export_name) - filedate.File(_FULL_PATH + export_name).set( + filedate.File(filename).set( created = create_date["created"], modified = create_date["modified"], accessed = create_date["accessed"] @@ -140,6 +146,12 @@ if _ACTION == "flip": except ValueError as e: print(e) print(f"Failed to move {export_name}") + + + + + + if _ACTION == "join": for _DAY_DIR in _DAY_DIRS: if ops == "win":