From a3617b1cff4361bd3712ba9d2e99a2e7bf5d16ef Mon Sep 17 00:00:00 2001 From: Symbiomatrix Date: Tue, 30 May 2023 19:29:33 +0300 Subject: [PATCH 1/2] Update run.py --- run.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/run.py b/run.py index be5511c..7e16348 100644 --- a/run.py +++ b/run.py @@ -161,9 +161,10 @@ def start(): process_img(args['source_img'], target_path, args['output_file']) status("swap successful!") return - video_name = target_path.split("/")[-1].split(".")[0] - output_dir = target_path.replace(target_path.split("/")[-1], "").rstrip("/") + "/" + video_name - Path(output_dir).mkdir(exist_ok=True) + video_name = os.path.basename(target_path) + video_name = os.path.splitext(video_name)[0] + output_dir = os.path.join(os.path.dirname(target_path),video_name) + os.makedirs(output_dir, exist_ok = True) status("detecting video's FPS...") fps = detect_fps(target_path) if not args['keep_fps'] and fps > 30: From cb2ff526788909a610f13010717d845c10ae91b2 Mon Sep 17 00:00:00 2001 From: Somdev Sangwan Date: Tue, 30 May 2023 22:04:38 +0530 Subject: [PATCH 2/2] just use Path --- run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run.py b/run.py index 7e16348..49ca578 100644 --- a/run.py +++ b/run.py @@ -164,7 +164,7 @@ def start(): video_name = os.path.basename(target_path) video_name = os.path.splitext(video_name)[0] output_dir = os.path.join(os.path.dirname(target_path),video_name) - os.makedirs(output_dir, exist_ok = True) + Path(output_dir).mkdir(exist_ok=True) status("detecting video's FPS...") fps = detect_fps(target_path) if not args['keep_fps'] and fps > 30: