]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
Improve 移除自动举报
authorqydysky <32743305+qydysky@users.noreply.github.com>
Sun, 26 Mar 2023 08:21:09 +0000 (16:21 +0800)
committerqydysky <32743305+qydysky@users.noreply.github.com>
Sun, 26 Mar 2023 08:21:09 +0000 (16:21 +0800)
Reply/F.go
Reply/Reply.go
Reply/stream.go

index 629c586b1b11a4c32a8587801ac327c8947c7dd5..4d8a6e5dbb2e83a4310244bf2f3d1ad037d95cf0 100644 (file)
@@ -459,71 +459,71 @@ func StreamOStop(roomid int) {
 //     }
 // }
 
-type Autoban struct {
-       Banbuf []string
-       buf    []string
-}
-
-var autoban = Autoban{}
-
-func Autobanf(s string) bool {
-       if !IsOn("Autoban") {
-               return false
-       }
+// type Autoban struct {
+//     Banbuf []string
+//     buf    []string
+// }
 
-       l := c.C.Log.Base("autoban")
+// var autoban = Autoban{}
 
-       if len(autoban.Banbuf) == 0 {
-               f := file.New("Autoban.txt", -1, false)
-               for {
-                       if data, e := f.ReadUntil('\n', 50, 5000); e != nil {
-                               if !errors.Is(e, io.EOF) {
-                                       l.L(`E: `, e)
-                               }
-                               break
-                       } else {
-                               autoban.Banbuf = append(autoban.Banbuf, string(data))
-                       }
-               }
-       }
-
-       if len(autoban.buf) < 10 {
-               autoban.buf = append(autoban.buf, s)
-               return false
-       }
-       defer func() {
-               autoban.buf = append(autoban.buf[1:], s)
-       }()
+// func Autobanf(s string) bool {
+//     if !IsOn("Autoban") {
+//             return false
+//     }
 
-       var res []float32
-       {
-               pt := float32(len([]rune(s)))
-               if pt <= 5 {
-                       return false
-               } //字数过少去除
-               res = append(res, pt)
-       }
-       {
-               pt := selfcross(s)
-               // if pt > 0.5 {return false}//自身重复高去除
-               // res = append(res, pt)
+//     l := c.C.Log.Base("autoban")
+
+//     if len(autoban.Banbuf) == 0 {
+//             f := file.New("Autoban.txt", -1, false)
+//             for {
+//                     if data, e := f.ReadUntil('\n', 50, 5000); e != nil {
+//                             if !errors.Is(e, io.EOF) {
+//                                     l.L(`E: `, e)
+//                             }
+//                             break
+//                     } else {
+//                             autoban.Banbuf = append(autoban.Banbuf, string(data))
+//                     }
+//             }
+//     }
 
-               pt1 := cross(s, autoban.buf)
-               if pt+pt1 > 0.3 {
-                       return false
-               } //历史重复高去除
-               res = append(res, pt, pt1)
-       }
-       {
-               pt := cross(s, autoban.Banbuf)
-               if pt < 0.8 {
-                       return false
-               } //ban字符重复低去除
-               res = append(res, pt)
-       }
-       l.L(`W: `, res)
-       return true
-}
+//     if len(autoban.buf) < 10 {
+//             autoban.buf = append(autoban.buf, s)
+//             return false
+//     }
+//     defer func() {
+//             autoban.buf = append(autoban.buf[1:], s)
+//     }()
+
+//     var res []float32
+//     {
+//             pt := float32(len([]rune(s)))
+//             if pt <= 5 {
+//                     return false
+//             } //字数过少去除
+//             res = append(res, pt)
+//     }
+//     {
+//             pt := selfcross(s)
+//             // if pt > 0.5 {return false}//自身重复高去除
+//             // res = append(res, pt)
+
+//             pt1 := cross(s, autoban.buf)
+//             if pt+pt1 > 0.3 {
+//                     return false
+//             } //历史重复高去除
+//             res = append(res, pt, pt1)
+//     }
+//     {
+//             pt := cross(s, autoban.Banbuf)
+//             if pt < 0.8 {
+//                     return false
+//             } //ban字符重复低去除
+//             res = append(res, pt)
+//     }
+//     l.L(`W: `, res)
+//     return true
+// }
 
 type Danmuji struct {
        Buf           map[string]string
index d6857aa688cb317b7da65c9cb9a97c4a9fc2864a..7d627faafa43a608852d1e24ff5ce1a6488aa16b 100644 (file)
@@ -1099,12 +1099,12 @@ func (replyF) danmu(s string) {
 
        { //附加功能 弹幕机 封禁 弹幕合并
                go Danmujif(item.msg)
-               if Autobanf(item.msg) {
-                       Gui_show(Itos([]interface{}{"风险", item.auth, ":", item.msg}))
-                       fmt.Println("风险", item.auth, ":", item.msg)
-                       msglog.Base_add("风险").L(`I: `, item.auth, ":", item.msg)
-                       return
-               }
+               // if Autobanf(item.msg) {
+               //      Gui_show(Itos([]interface{}{"风险", item.auth, ":", item.msg}))
+               //      fmt.Println("风险", item.auth, ":", item.msg)
+               //      msglog.Base_add("风险").L(`I: `, item.auth, ":", item.msg)
+               //      return
+               // }
                if i := Autoskipf(item.msg); i > 0 {
                        msglog.L(`I: `, item.auth, ":", item.msg)
                        return
index c75b549729944176a24c2de5e114533b2b1dc78e..d61df9d2d64898b736adf503538abc78e5679f2b 100644 (file)
@@ -661,12 +661,12 @@ func (t *M4SStream) saveStreamFlv() (e error) {
                }
 
                // 如果被主动关闭,则退出saveStreamFlv,否则继续尝试其他live
-               s := signal.Init()
+               needStop := signal.Init()
                {
                        go func() {
                                tsc, tscf := t.Status.WaitC()
                                defer tscf()
-                               sc, scf := s.WaitC()
+                               sc, scf := needStop.WaitC()
                                defer scf()
 
                                select {
@@ -689,7 +689,7 @@ func (t *M4SStream) saveStreamFlv() (e error) {
                                timer := time.NewTicker(5 * time.Second)
                                defer timer.Stop()
 
-                               sc, scf := s.WaitC()
+                               sc, scf := needStop.WaitC()
                                defer scf()
 
                                for {
@@ -707,7 +707,7 @@ func (t *M4SStream) saveStreamFlv() (e error) {
                                                        if t.config.want_qn != int(v) {
                                                                t.log.L(`I: `, "直播流清晰度改变:", t.common.Qn[t.config.want_qn], "=>", t.common.Qn[int(v)])
                                                                t.config.want_qn = int(v)
-                                                               s.Done()
+                                                               needStop.Done()
                                                                r.Cancel()
                                                                return
                                                        }
@@ -812,8 +812,8 @@ func (t *M4SStream) saveStreamFlv() (e error) {
                }
                t.reqPool.Put(r)
 
-               if s.Islive() {
-                       s.Done()
+               if needStop.Islive() {
+                       needStop.Done()
                } else {
                        return
                }