From 7babcd2869aaece4f06d762cd849927bafd8b86a Mon Sep 17 00:00:00 2001 From: "kyj@bowong.ai" Date: Wed, 26 Mar 2025 18:08:56 +0800 Subject: [PATCH] =?UTF-8?q?FIX=20=E6=9B=B4=E6=94=B9=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nodes/videocut.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/nodes/videocut.py b/nodes/videocut.py index 99a0157..110020d 100644 --- a/nodes/videocut.py +++ b/nodes/videocut.py @@ -154,7 +154,7 @@ class VideoCutByFramePoint: uid = uuid.uuid1() temp_fname = os.sep.join( [ - *video_path.split(os.sep)[:-1], + os.path.dirname(__file__), "%s.%s" % (str(uid), video_path.split(".")[-1]), ] ) @@ -173,7 +173,7 @@ class VideoCutByFramePoint: ] ) output = ( - os.sep.join([*video_path.split(os.sep)[:-1], output_name]) + os.sep.join([os.path.dirname(__file__), output_name]) .replace( os.sep.join(["ComfyUI", "input"]), os.sep.join(["ComfyUI", "output"]) ) @@ -214,21 +214,21 @@ class VideoCutByFramePoint: os.remove(temp_fname) except: pass - try: - files = glob.glob(output.replace("%03d", "*")) - for file in files: - shutil.move(file, file.replace(str(uid), origin_fname)) - files = glob.glob( - output.replace(str(uid), origin_fname).replace("%03d", "*") - ) - except: - files = glob.glob(output.replace("%03d", "*")) - traceback.print_exc() - video, audio, info = torchvision.io.read_video(files[0]) + # try: + # files = glob.glob(output.replace("%03d", "*")) + # for file in files: + # shutil.move(file, file.replace(str(uid), origin_fname)) + # files = glob.glob( + # output.replace(str(uid), origin_fname).replace("%03d", "*") + # ) + # except: + # files = glob.glob(output.replace("%03d", "*")) + # traceback.print_exc() + video, audio, info = torchvision.io.read_video(output) video.mul_(255) audio.unsqueeze_(0) try: - os.remove(files[0]) + os.remove(output) except: pass return (video, {"waveform":audio,"sample_rate":info["audio_fps"]},)