This commit is contained in:
suyl
2021-08-10 10:45:38 +08:00
parent e746693d93
commit 60ae59f801

View File

@@ -245,15 +245,17 @@ func (t *TcpClient) doPrint(key string) (err error) {
globals.SugarLogger.Debugf("handleTcpMessages success, data: %v", hex.EncodeToString(data)) globals.SugarLogger.Debugf("handleTcpMessages success, data: %v", hex.EncodeToString(data))
//等待回调 //等待回调
dataStr := <-t.CallBackMap[printMsg.PrintNo] dataStr := <-t.CallBackMap[printMsg.PrintNo]
a, b := getCallbackMsgInfo(dataStr) if dataStr != "" {
t.changePrintMsg(dataStr, a, b) a, b := getCallbackMsgInfo(dataStr)
//判断音频暂停? t.changePrintMsg(dataStr, a, b)
//收到打印成功回调后,如果消息中有音频,需要等待一下,等上一个音频播完 //判断音频暂停?
//暂停时间就暂时取的sound标签内内容长度/2 //收到打印成功回调后,如果消息中有音频,需要等待一下,等上一个音频播完
if sounds := regexpSoundSpan.FindStringSubmatch(printMsg.Content); len(sounds) > 0 { //暂停时间就暂时取的sound标签内内容长度/2
sound := sounds[1] if sounds := regexpSoundSpan.FindStringSubmatch(printMsg.Content); len(sounds) > 0 {
lenTime := time.Duration(utf8.RuneCountInString(sound)) * time.Second sound := sounds[1]
time.Sleep(lenTime / 2) lenTime := time.Duration(utf8.RuneCountInString(sound)) * time.Second
time.Sleep(lenTime / 2)
}
} }
} }
} }