兼容linux
This commit is contained in:
@@ -104,7 +104,7 @@ class VideoManPlugin(MessagePluginInterface):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
# 下载视频
|
# 下载视频
|
||||||
file_abspath,first_frame = self._download_video("https://api.guiguiya.com/api/video/fuji?type=json")
|
file_abspath, first_frame = self._download_video("https://api.guiguiya.com/api/video/fuji?type=json")
|
||||||
# FIXME 需要换成web容器地址。否则无法获取。
|
# FIXME 需要换成web容器地址。否则无法获取。
|
||||||
if not file_abspath:
|
if not file_abspath:
|
||||||
await self.bot.send_text_message((roomid if roomid else sender), f"\n❌视频下载失败,请稍后再试",
|
await self.bot.send_text_message((roomid if roomid else sender), f"\n❌视频下载失败,请稍后再试",
|
||||||
@@ -112,7 +112,8 @@ class VideoManPlugin(MessagePluginInterface):
|
|||||||
return False, "视频下载失败"
|
return False, "视频下载失败"
|
||||||
|
|
||||||
# 发送视频
|
# 发送视频
|
||||||
result = await self.bot.send_video_message((roomid if roomid else sender), Path(file_abspath),Path(first_frame))
|
result = await self.bot.send_video_message((roomid if roomid else sender), Path(file_abspath),
|
||||||
|
Path(first_frame))
|
||||||
self.LOG.info(f"发送视频结果: {result}")
|
self.LOG.info(f"发送视频结果: {result}")
|
||||||
return True, "发送成功"
|
return True, "发送成功"
|
||||||
|
|
||||||
@@ -163,7 +164,7 @@ class VideoManPlugin(MessagePluginInterface):
|
|||||||
first_frame_path = os.path.join(self.download_dir, f"frame_{int(time.time())}.jpg")
|
first_frame_path = os.path.join(self.download_dir, f"frame_{int(time.time())}.jpg")
|
||||||
first_frame = self._get_first_frame(save_path, first_frame_path)
|
first_frame = self._get_first_frame(save_path, first_frame_path)
|
||||||
|
|
||||||
return abs_path,first_frame
|
return abs_path, first_frame
|
||||||
|
|
||||||
except requests.RequestException as e:
|
except requests.RequestException as e:
|
||||||
self.LOG.error(f"请求失败: {e}")
|
self.LOG.error(f"请求失败: {e}")
|
||||||
|
|||||||
Reference in New Issue
Block a user