优化首帧功能,如果没传入首帧,则提取首帧。
This commit is contained in:
@@ -235,7 +235,7 @@ class MessageMixin(WechatAPIClientBase):
|
||||
if not has_image:
|
||||
first_frame = _get_first_frame_bytes(video, f"frame_{int(time.time())}.jpg")
|
||||
if first_frame:
|
||||
image = first_frame
|
||||
image = Path(first_frame)
|
||||
elif isinstance(video, os.PathLike):
|
||||
video_path = Path(video)
|
||||
if not video_path.exists():
|
||||
@@ -249,7 +249,7 @@ class MessageMixin(WechatAPIClientBase):
|
||||
if not has_image:
|
||||
first_frame = _get_first_frame(video_path, f"frame_{int(time.time())}.jpg")
|
||||
if first_frame:
|
||||
image = first_frame
|
||||
image = Path(first_frame)
|
||||
else:
|
||||
raise ValueError("video should be str, bytes, or path")
|
||||
# 获取视频时长
|
||||
|
||||
Reference in New Issue
Block a user