From 53fdf6c53208db68c28e33fb9f1e53979fee979d Mon Sep 17 00:00:00 2001 From: qydysky Date: Tue, 30 Jan 2024 02:19:55 +0800 Subject: [PATCH] =?utf8?q?Fix=20=E6=A0=87=E9=A2=98=E4=B8=8D=E4=BF=AE?= =?utf8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Reply/F.go | 11 +++++++---- Reply/Reply.go | 4 +++- bili_danmu.go | 6 ++++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Reply/F.go b/Reply/F.go index 3121f6b..c42e369 100644 --- a/Reply/F.go +++ b/Reply/F.go @@ -361,16 +361,19 @@ func StreamOStop(roomid int) { } // 实例切断 -func StreamOCut(roomid int, title ...string) { +func StreamOCut(roomid int) (setTitle func(string)) { if v, ok := streamO.Load(roomid); ok { if !pctx.Done(v.(*M4SStream).Status) { - if len(title) != 0 { - v.(*M4SStream).Common().Title = title[0] - } v.(*M4SStream).Cut() flog.L(`I: `, `已切片 `+strconv.Itoa(roomid)) + return func(title string) { + if title != "" { + v.(*M4SStream).Common().Title = title + } + } } } + return func(s string) {} } // type Obs struct { diff --git a/Reply/Reply.go b/Reply/Reply.go index 1cd53e3..8a8bff3 100644 --- a/Reply/Reply.go +++ b/Reply/Reply.go @@ -556,7 +556,7 @@ func (replyF) room_change(s string) { c.C.Title = type_item.Data.Title } - StreamOCut(c.C.Roomid, type_item.Data.Title) + setTitle := StreamOCut(c.C.Roomid) if c.C.Title == type_item.Data.Title && c.C.AreaID == type_item.Data.AreaID { // 直播间标题引入审核机制,触发审核时会接收到一个roomchange但标题不变 @@ -573,6 +573,7 @@ func (replyF) room_change(s string) { case <-time.After(time.Second * 30): F.Get(c.C).Get(`Title`) if c.C.Roomid == roomid && c.C.Title != oldTitle { + setTitle(c.C.Title) var sh = []any{"房间改变", c.C.Title} Gui_show(Itos(sh), "0room") msglog.Base_add("房").L(`I: `, sh...) @@ -584,6 +585,7 @@ func (replyF) room_change(s string) { return } + setTitle(type_item.Data.Title) var sh = []any{"房间改变", type_item.Data.Title, type_item.Data.AreaName} Gui_show(Itos(sh), "0room") msglog.Base_add("房").L(`I: `, sh...) diff --git a/bili_danmu.go b/bili_danmu.go index b4034cb..0bbed6a 100644 --- a/bili_danmu.go +++ b/bili_danmu.go @@ -111,8 +111,10 @@ func Start() { } // 指定弹幕重启录制 if _, err := danmuReLiveTriger.Init.Run(mainCtx, danmuReLiveTriger.DanmuReLiveTriger{ - StreamCut: reply.StreamOCut, - C: c.C, + StreamCut: func(i int, title ...string) { + reply.StreamOCut(i)(title[0]) + }, + C: c.C, }); err != nil { danmulog.Base("功能", "指定弹幕重启录制").L(`E: `, err) } -- 2.39.2