Commit c3c8998c by xiaoqi

脚本

parent d3583746
Showing with 4 additions and 20 deletions
......@@ -14,7 +14,7 @@ import numpy as np
from PIL import Image, ImageEnhance
from moviepy import *
from moviepy import VideoFileClip, clips_array
import traceback
# p_preset = "veryslow"
p_preset = "veryslow"
p_bitrate = "2000k"
......@@ -349,27 +349,11 @@ def check_file_or_dir(userinput,output_file_path: str = None, output_name: str =
future.result() # 这里可以获取process_webp_file的返回值(如果有)
except Exception as exc:
print(f'{file_path} 处理异常: {exc}')
print("详细堆栈信息如下:")
traceback.print_exc()
# def check_file_or_dir(userinput, output_name: str = None):
# # 检查路径是否存在
# if not os.path.exists(userinput):
# print(f"路径不存在:{userinput}")
# return
#
# # 如果是目录,递归处理目录中的所有文件
# if os.path.isdir(userinput):
# for dirpath, _, filenames in os.walk(userinput):
# for filename in filenames:
# full_path = os.path.join(dirpath, filename)
# process_webp_file(full_path, output_name=output_name)
#
# # 如果是文件,直接处理
# elif os.path.isfile(userinput):
# process_webp_file(userinput, output_name=output_name)
#
# else:
# print(f"路径既不是文件也不是目录:{userinput}")
def process_webp_file(file_path, output_file_path: str = None,output_name: str = None):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment