limit *limit.Limit
max_num int
threshold float32
-
- sync.RWMutex
}
var lessdanmu = Lessdanmu{
}
func init() {
- if max_num,ok := c.K_v.LoadV(`每10秒显示弹幕数`).(float64);ok && int(max_num) >= 1 {
- flog.Base_add(`更少弹幕`).L(`T: `,`每10秒弹幕数:`,int(max_num))
+ if max_num,ok := c.K_v.LoadV(`每秒显示弹幕数`).(float64);ok && int(max_num) >= 1 {
+ flog.Base_add(`更少弹幕`).L(`T: `,`每秒弹幕数:`,int(max_num))
lessdanmu.max_num = int(max_num)
- lessdanmu.limit = limit.New(int(max_num),10000,0)
- go func(){
- //等待启动
- for lessdanmu.limit.PTK() == lessdanmu.max_num {
- time.Sleep(time.Second*3)
- }
-
- for {
- time.Sleep(time.Second*10)
-
- lessdanmu.Lock()
- if lessdanmu.roomid != c.Roomid {
- lessdanmu.buf = nil
- lessdanmu.roomid = c.Roomid
- lessdanmu.threshold = 0.7
- flog.Base_add(`更少弹幕`).L(`T: `,`房间更新:`,lessdanmu.roomid)
- lessdanmu.Unlock()
- continue
- }
- if ptk := lessdanmu.limit.PTK();ptk == lessdanmu.max_num {
- if lessdanmu.threshold > 0.03 {
- lessdanmu.threshold -= 0.03
- }
- } else if ptk == 0 {
- if lessdanmu.threshold < 0.97 {
- lessdanmu.threshold += 0.03
- }
- }
- lessdanmu.Unlock()
- }
- }()
+ lessdanmu.limit = limit.New(int(max_num),1000,0)//timeout right now
}
}
func Lessdanmuf(s string) (show bool) {
if !IsOn("相似弹幕忽略") {return true}
if lessdanmu.roomid != c.Roomid {
- lessdanmu.Lock()
lessdanmu.buf = nil
lessdanmu.roomid = c.Roomid
lessdanmu.threshold = 0.7
- lessdanmu.Unlock()
flog.Base_add(`更少弹幕`).L(`T: `,`房间更新:`,lessdanmu.roomid)
return true
}
Jiezouf(lessdanmu.buf)
lessdanmu.buf = append(lessdanmu.buf[1:], s)
- lessdanmu.RLock()
show = o < lessdanmu.threshold
- lessdanmu.RUnlock()
if show && lessdanmu.max_num > 0 {
- lessdanmu.limit.TO()
+ return !lessdanmu.limit.TO()
}
return
}
if room == 0 && len(roomid) != 0 {
room = roomid[0]
}
+
+ //如果连接中断,则等待
+ F.KeepConnect()
+ //获取cookie
+ F.Get(`Cookie`)
if room == 0 {
c.Log.Block(1000)//等待所有日志输出完毕
fmt.Println("输入房间号或` live`获取正在直播的主播")
go func(){change_room_chan <- struct{}{}}()
}
}
-
-
- //如果连接中断,则等待
- F.KeepConnect()
- //获取cookie
- F.Get(`Cookie`)
//命令行操作 切换房间 发送弹幕
go F.Cmd()
"弹幕处理": "",
"弹幕合并": true,
"相似弹幕忽略": true,
- "每10秒显示弹幕数-help": "为0时禁用,相似弹幕忽略需设为true",
- "每10秒显示弹幕数": 10,
+ "每秒显示弹幕数-help": "为0时禁用,相似弹幕忽略需设为true",
+ "每秒显示弹幕数": 1,
"精简弹幕": true,
"弹幕机": "",
"反射弹幕机": true,
github.com/miekg/dns v1.1.42 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/qydysky/bili_danmu v0.5.9
- github.com/qydysky/part v0.5.23 // indirect
+ github.com/qydysky/part v0.5.24 // indirect
github.com/shirou/gopsutil v3.21.5+incompatible // indirect
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e // indirect
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 // indirect
github.com/qydysky/part v0.5.22/go.mod h1:43opuciW71sZvOR67kye50jgMDSDrn/t6+LefNdlXPg=
github.com/qydysky/part v0.5.23 h1:JaP+t+ILHScJh7FPE6AUPqrkdMhfRIXSgAetJNPFTp0=
github.com/qydysky/part v0.5.23/go.mod h1:43opuciW71sZvOR67kye50jgMDSDrn/t6+LefNdlXPg=
+github.com/qydysky/part v0.5.24 h1:hnHI5SPpm6I61/q7s83D3NlHgIMHjsvukw6xAbZeanc=
+github.com/qydysky/part v0.5.24/go.mod h1:43opuciW71sZvOR67kye50jgMDSDrn/t6+LefNdlXPg=
github.com/qydysky/part/msgq v0.0.0-20201213031129-ca3253dc72ad h1:Jtzf509lQrkUMGTV0Sc6IDCAiR1VrBcHrIban7hpye4=
github.com/qydysky/part/msgq v0.0.0-20201213031129-ca3253dc72ad/go.mod h1:w32TkJNVtTJd4LOS09cq+4uYG6itcN2vsqw+slp44Rg=
github.com/qydysky/part/msgq v0.0.0-20201213120821-f36e49c32bba h1:1ew9dRpc0Rux0WkWeT/4AE15ynYWmL2D7onJEJIFOB8=
github.com/mdp/qrterminal/v3 v3.0.0
github.com/miekg/dns v1.1.42 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
- github.com/qydysky/part v0.5.23
+ github.com/qydysky/part v0.5.24
github.com/shirou/gopsutil v3.21.5+incompatible // indirect
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
github.com/tklauser/go-sysconf v0.3.6 // indirect
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b // indirect
- golang.org/x/net v0.0.0-20210525063256-abc453219eb5 // indirect
- golang.org/x/sys v0.0.0-20210608053332-aa57babbf139 // indirect
+ golang.org/x/net v0.0.0-20210610132358-84b48f89b13b // indirect
+ golang.org/x/sys v0.0.0-20210611083646-a4fc73990273 // indirect
golang.org/x/text v0.3.6
)
github.com/qydysky/part v0.5.22/go.mod h1:43opuciW71sZvOR67kye50jgMDSDrn/t6+LefNdlXPg=
github.com/qydysky/part v0.5.23 h1:JaP+t+ILHScJh7FPE6AUPqrkdMhfRIXSgAetJNPFTp0=
github.com/qydysky/part v0.5.23/go.mod h1:43opuciW71sZvOR67kye50jgMDSDrn/t6+LefNdlXPg=
+github.com/qydysky/part v0.5.24 h1:hnHI5SPpm6I61/q7s83D3NlHgIMHjsvukw6xAbZeanc=
+github.com/qydysky/part v0.5.24/go.mod h1:43opuciW71sZvOR67kye50jgMDSDrn/t6+LefNdlXPg=
github.com/qydysky/part/msgq v0.0.0-20201213120821-f36e49c32bba h1:1ew9dRpc0Rux0WkWeT/4AE15ynYWmL2D7onJEJIFOB8=
github.com/qydysky/part/msgq v0.0.0-20201213120821-f36e49c32bba/go.mod h1:w32TkJNVtTJd4LOS09cq+4uYG6itcN2vsqw+slp44Rg=
github.com/shirou/gopsutil v2.20.7+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210525063256-abc453219eb5 h1:wjuX4b5yYQnEQHzd+CBcrcC6OVR2J1CN6mUy0oSxIPo=
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
+golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A=
+golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210608053332-aa57babbf139 h1:C+AwYEtBp/VQwoLntUmQ/yx3MS9vmZaKNdw5eOpoQe8=
golang.org/x/sys v0.0.0-20210608053332-aa57babbf139/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210611083646-a4fc73990273 h1:faDu4veV+8pcThn4fewv6TVlNCezafGoC1gM/mxQLbQ=
+golang.org/x/sys v0.0.0-20210611083646-a4fc73990273/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=