]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
Fix 标题不修改
authorqydysky <qydysky@foxmail.com>
Mon, 29 Jan 2024 18:19:55 +0000 (02:19 +0800)
committerqydysky <qydysky@foxmail.com>
Mon, 29 Jan 2024 18:19:55 +0000 (02:19 +0800)
Reply/F.go
Reply/Reply.go
bili_danmu.go

index 3121f6bcb7c68bcd4af3db36e399711db115b453..c42e369dd2acbacc42887aae9157b198f0d86da4 100644 (file)
@@ -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 {
index 1cd53e376861916100e9c049eae881fefa3098c5..8a8bff35a1e92d3144fac90e5596ea4b1b467bc1 100644 (file)
@@ -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...)
index b4034cb63ad782fb6d07cda8a440431ed9f2f5ce..0bbed6a1fe1267066536f98c0081c782ed05cd36 100644 (file)
@@ -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)
                }