// }
// }
-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
{ //附加功能 弹幕机 封禁 弹幕合并
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
}
// 如果被主动关闭,则退出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 {
timer := time.NewTicker(5 * time.Second)
defer timer.Stop()
- sc, scf := s.WaitC()
+ sc, scf := needStop.WaitC()
defer scf()
for {
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
}
}
t.reqPool.Put(r)
- if s.Islive() {
- s.Done()
+ if needStop.Islive() {
+ needStop.Done()
} else {
return
}