This commit is contained in:
liuwei
2025-05-21 09:56:21 +08:00
parent 7e133c7510
commit dbb6bb2583
3 changed files with 12 additions and 4 deletions

View File

@@ -249,8 +249,8 @@ class MessageMixin(WechatAPIClientBase):
image_base64 = base64.b64encode(f.read()).decode()
else:
raise ValueError("image should be str, bytes, or path")
self.logging.debug(f"vid_base64:{vid_base64}")
self.logging.debug(f"images_base64:{image_base64}")
# self.logging.debug(f"vid_base64:{vid_base64}")
# self.logging.debug(f"images_base64:{image_base64}")
# 打印预估时间300KB/s
predict_time = int(file_len / 1024 / 300)
self.logging.info("开始发送视频: 对方wxid:{} 视频base64略 图片base64略 预计耗时:{}", wxid, predict_time)
@@ -259,10 +259,10 @@ class MessageMixin(WechatAPIClientBase):
json_param = {"Wxid": self.wxid, "ToWxid": wxid, "Base64": "data:video/mp4;base64,"+vid_base64,
"ImageBase64": "data:image/jpeg;base64," + image_base64,
"PlayLength": duration}
self.logging.debug(f"json_param:{json_param}")
# self.logging.debug(f"json_param:{json_param}")
async with session.post(f'http://{self.ip}:{self.port}/api/Msg/SendVideo', json=json_param) as resp:
json_resp = await resp.json()
self.logging.debug(f"json_resp:{json_resp}")
# self.logging.debug(f"json_resp:{json_resp}")
if json_resp.get("Success"):
json_param.pop('Base64')
json_param.pop('ImageBase64')