Skip to content

Commit c944653

Browse files
committed
video cache
1 parent 0afad6d commit c944653

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

service/bot/proto2mirai.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -356,16 +356,13 @@ func ProtoVideoToMiraiVideo(cli *client.QQClient, data map[string]string) (m mes
356356
return EmptyText()
357357
}
358358
}
359-
if !util.PathExists(videoFilePath) {
360-
if err := util.DownloadFileMultiThreading(url, videoFilePath, 100*1024*1024, 8, nil); err != nil {
361-
log.Errorf("failed to download video file, err: %+v", err)
362-
return EmptyText()
363-
}
364-
} else if data["cache"] == "0" {
359+
if data["cache"] == "0" && util.PathExists(videoFilePath) {
365360
if err := os.Remove(videoFilePath); err != nil {
366361
log.Errorf("删除缓存文件 %v 时出现错误: %v", videoFilePath, err)
367362
return EmptyText()
368363
}
364+
}
365+
if !util.PathExists(videoFilePath) {
369366
if err := util.DownloadFileMultiThreading(url, videoFilePath, 100*1024*1024, 8, nil); err != nil {
370367
log.Errorf("failed to download video file, err: %+v", err)
371368
return EmptyText()

0 commit comments

Comments
 (0)