mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-08 21:15:56 +08:00
fix thumb.
This commit is contained in:
parent
50f0f572bc
commit
eaec0e545f
@ -1021,10 +1021,12 @@ video:
|
|||||||
b, _ := ioutil.ReadFile(rawPath)
|
b, _ := ioutil.ReadFile(rawPath)
|
||||||
r := binary.NewReader(b)
|
r := binary.NewReader(b)
|
||||||
return &LocalVideoElement{ShortVideoElement: message.ShortVideoElement{ // todo 检查缓存是否有效
|
return &LocalVideoElement{ShortVideoElement: message.ShortVideoElement{ // todo 检查缓存是否有效
|
||||||
Md5: r.ReadBytes(16),
|
Md5: r.ReadBytes(16),
|
||||||
Size: r.ReadInt32(),
|
ThumbMd5: r.ReadBytes(16),
|
||||||
Name: r.ReadString(),
|
Size: r.ReadInt32(),
|
||||||
Uuid: r.ReadAvailable(),
|
ThumbSize: r.ReadInt32(),
|
||||||
|
Name: r.ReadString(),
|
||||||
|
Uuid: r.ReadAvailable(),
|
||||||
}}, nil
|
}}, nil
|
||||||
} else {
|
} else {
|
||||||
return &LocalVideoElement{File: rawPath}, nil
|
return &LocalVideoElement{File: rawPath}, nil
|
||||||
|
@ -566,7 +566,9 @@ func (bot *CQBot) checkMedia(e []message.IMessageElement) {
|
|||||||
if !global.PathExists(path.Join(global.VIDEO_PATH, filename)) {
|
if !global.PathExists(path.Join(global.VIDEO_PATH, filename)) {
|
||||||
_ = ioutil.WriteFile(path.Join(global.VIDEO_PATH, filename), binary.NewWriterF(func(w *binary.Writer) {
|
_ = ioutil.WriteFile(path.Join(global.VIDEO_PATH, filename), binary.NewWriterF(func(w *binary.Writer) {
|
||||||
w.Write(i.Md5)
|
w.Write(i.Md5)
|
||||||
|
w.Write(i.ThumbMd5)
|
||||||
w.WriteUInt32(uint32(i.Size))
|
w.WriteUInt32(uint32(i.Size))
|
||||||
|
w.WriteUInt32(uint32(i.ThumbSize))
|
||||||
w.WriteString(i.Name)
|
w.WriteString(i.Name)
|
||||||
w.Write(i.Uuid)
|
w.Write(i.Uuid)
|
||||||
}), 0644)
|
}), 0644)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user