Shamrock: fix #242

This commit is contained in:
白池 2024-02-18 21:07:22 +08:00
parent c3e0031aa4
commit 0ed4480878
2 changed files with 12 additions and 5 deletions

View File

@ -17,6 +17,7 @@ import moe.fuqiuluo.shamrock.helper.db.ImageMapping
import moe.fuqiuluo.shamrock.helper.db.MessageDB
import moe.fuqiuluo.shamrock.tools.asJsonObject
import moe.fuqiuluo.shamrock.tools.asString
import moe.fuqiuluo.shamrock.tools.hex2ByteArray
import moe.fuqiuluo.shamrock.tools.json
import mqq.app.MobileQQ
import kotlin.jvm.internal.Intrinsics
@ -213,7 +214,13 @@ internal sealed class MessageElemConverter: IMessageConvert {
element: MsgElement
): MessageSegment {
val video = element.videoElement
val md5 = video.fileName.split(".")[0]
val md5 = if (video.fileName.contains("/")) {
video.videoMd5.takeIf {
!it.isNullOrEmpty()
}?.hex2ByteArray() ?: video.fileName.split("/").let {
it[it.size - 2].hex2ByteArray()
}
} else video.fileName.split(".")[0].hex2ByteArray()
LogCenter.log({ "receive video msg: $video" }, Level.DEBUG)

View File

@ -205,7 +205,7 @@ internal object RichProtoSvc: BaseSvc() {
suspend fun getC2CVideoDownUrl(
peerId: String,
md5Hex: String,
md5: ByteArray,
fileUUId: String
): String {
return suspendCancellableCoroutine {
@ -221,7 +221,7 @@ internal object RichProtoSvc: BaseSvc() {
downReq.troopUin = peerId
downReq.clientType = 2
downReq.fileId = fileUUId
downReq.md5 = md5Hex.hex2ByteArray()
downReq.md5 = md5
downReq.busiType = FileTransfer.BUSI_TYPE_SHORT_VIDEO
downReq.subBusiType = 0
downReq.fileType = FileTransfer.VIDEO_FORMAT_MP4
@ -248,7 +248,7 @@ internal object RichProtoSvc: BaseSvc() {
suspend fun getGroupVideoDownUrl(
peerId: String,
md5Hex: String,
md5: ByteArray,
fileUUId: String
): String {
return suspendCancellableCoroutine {
@ -264,7 +264,7 @@ internal object RichProtoSvc: BaseSvc() {
downReq.troopUin = peerId
downReq.clientType = 2
downReq.fileId = fileUUId
downReq.md5 = md5Hex.hex2ByteArray()
downReq.md5 = md5
downReq.busiType = FileTransfer.BUSI_TYPE_SHORT_VIDEO
downReq.subBusiType = 0
downReq.fileType = FileTransfer.VIDEO_FORMAT_MP4