]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
fix dep
authorqydysky <qydysky@foxmail.com>
Tue, 10 Nov 2020 21:48:03 +0000 (05:48 +0800)
committerqydysky <qydysky@foxmail.com>
Tue, 10 Nov 2020 21:48:03 +0000 (05:48 +0800)
.github/workflows/go.yml
.github/workflows/test.yml
Reply/F.go
Reply/Reply.go
Reply/gtk.go
VERSION
demo/config_F.json
demo/go.mod
demo/go.sum

index 45a3f9e54c1452ee4afffad7e9f7a19fe7d8fb40..5b942cea51a1344ef2792cc5c24463e338df6e29 100644 (file)
@@ -40,7 +40,7 @@ jobs:
     - name: Set up Go
       uses: actions/setup-go@v2
       with:
-        go-version: ^1.15.3
+        go-version: ^1.15.4
       id: go
 
     - name: Check out code
@@ -85,7 +85,7 @@ jobs:
     - name: Set up Go
       uses: actions/setup-go@v2
       with:
-        go-version: ^1.15.3
+        go-version: ^1.15.4
       id: go
 
     - name: Set up C
index c8bd79ed6d8bbabc6c92f880dee2fd7aa2f2ff37..2df02b77a3f9d1ad1c91282808e703a361c64a59 100644 (file)
@@ -18,7 +18,7 @@ jobs:
     - name: Set up Go
       uses: actions/setup-go@v2
       with:
-        go-version: ^1.15.3
+        go-version: ^1.15.4
       id: go
 
     - name: Check out code
@@ -45,7 +45,7 @@ jobs:
     - name: Set up Go
       uses: actions/setup-go@v2
       with:
-        go-version: ^1.15.3
+        go-version: ^1.15.4
       id: go
 
     - name: Set up C
index 23f551493e0b5fca787adf9f7bdf8d38dd534388..d82948bc143b5d8a184237da19651ae5dc82342d 100644 (file)
@@ -283,12 +283,13 @@ func Saveflvf(){
                }
 
                {//重试
+                       l.I("尝试连接live")
                        if e := rr.Reqf(p.Rval{
                                Url:c.Live[cuLinkIndex],
                                Retry:10,
                                SleepTime:5,
                                Cookie:Cookie,
-                               Timeout:-1,
+                               Timeout:5,
                                JustResponseCode:true,
                        }); e != nil{l.W(e)}
 
index 00f8b7f6c07ef0b1dd833bc58c0b7f3b32e1dfe1..7ce79063dc010ede1ad242337c3ae17e92483b46 100644 (file)
@@ -391,7 +391,16 @@ func (replyF) live(s string) {
 }
 
 //Msg-超级留言处理
+var sc_buf = make(map[string]bool)
 func (replyF) super_chat_message(s string){
+       id := p.Json().GetValFromS(s, "data.id");
+       if id != nil {
+               if _,ok := sc_buf[id.(string)];ok{return}
+               if len(sc_buf) >= 10 {
+                       for k,_ := range sc_buf {delete(sc_buf, k);break}
+               }
+               sc_buf[id.(string)] = true
+       }
        uname := p.Json().GetValFromS(s, "data.user_info.uname");
        price := p.Json().GetValFromS(s, "data.price");
        message := p.Json().GetValFromS(s, "data.message");
index 8a6e87756848869ed63270d3c6057b33559b6b34..e5bb400f1f632ff6c71108981392924fdc1bbc08 100644 (file)
@@ -12,7 +12,12 @@ import (
        p "github.com/qydysky/part"
        F "github.com/qydysky/bili_danmu/F"
 )
-const max = 50
+const (
+       max = 50
+       max_keep = 5
+       max_img = 500
+)
+
 const appId = "com.github.qydysky.bili_danmu.reply"
 
 type gtk_list struct {
@@ -34,7 +39,7 @@ var keep_key = map[string]int{
        "face/0jiezou":8,
        "face/0level1":5,
        "face/0level2":3,
-       "face/0level3":2,
+       "face/0level3":1,
        "face/0superchat":13,
 }
 var (
@@ -47,12 +52,13 @@ var (
 
 func Gtk_danmu() {
        if Gtk_on {return}
+       gtk.Init(nil)
 
        var y func(string,string)
        var win *gtk.Window
        var scrolledwindow0 *gtk.ScrolledWindow
        var viewport0 *gtk.Viewport
-
+       
        application, err := gtk.ApplicationNew(appId, glib.APPLICATION_FLAGS_NONE)
        if err != nil {log.Println(err);return}
 
@@ -174,7 +180,7 @@ func Gtk_danmu() {
                                        back index:0
                                */
                                var InsertIndex int = keep_list.Len()
-                               if sec != 0 {
+                               if sec > InsertIndex / max_keep {
                                        var cu_To = time.Now().Add(time.Second * time.Duration(sec))
                                        var hasInsert bool
                                        for el := keep_list.Front(); el != nil; el = el.Next(){
@@ -220,7 +226,7 @@ func Gtk_danmu() {
                                }
 
                                {
-                                       if len(imgbuf) > 1000 {
+                                       if len(imgbuf) > max_img {
                                                for k,_ := range imgbuf {delete(imgbuf,k);break}
                                        }
                                }
@@ -238,10 +244,10 @@ func Gtk_danmu() {
                go func(){
                        for{
                                time.Sleep(time.Second)
+                               if len(Gtk_danmuChan) == 0 {continue}
                                for el := keep_list.Front(); el != nil && time.Now().After(el.Value.(time.Time));el = el.Next() {
                                        keep_list.Remove(el)
                                }
-                               if len(Gtk_danmuChan) == 0 {continue}
                                glib.TimeoutAdd(uint(1000 / (len(Gtk_danmuChan) + 1)),func()(bool){
                                        if len(Gtk_danmuChan) == 0 {return false}
                                        y(<-Gtk_danmuChan,load_face(<-Gtk_danmuChan_uid))
diff --git a/VERSION b/VERSION
index 71104c6f917f5950b26d90ed73c99f282201288b..c1682382623c028f2d6a8d3af5587cb3d9cf365e 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-202010231620
\ No newline at end of file
+202011110547
\ No newline at end of file
index 944a7bceed1de00f90942d69c277f9d617991021..43956903696f13b6f50ac96d981366318d30db4b 100644 (file)
@@ -1,7 +1,7 @@
 {
     "Gtk": true,
     "Qtd": false,
-    "Saveflv": false,
+    "Saveflv": true,
     "Ass": true,
     "Obs": false,
     "Autoban": false,
index 6514f700f1f7737e985161f7febe07c27a73d7d9..3ddd0cc4970e2c974ba345d893764ed13a393b0f 100644 (file)
@@ -5,7 +5,7 @@ go 1.14
 require (
        github.com/christopher-dG/go-obs-websocket v0.0.0-20200720193653-c4fed10356a5 // indirect
        github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 // indirect
-       github.com/gotk3/gotk3 v0.5.0 // indirect
+       github.com/gotk3/gotk3 v0.5.1-0.20201028052159-952547abf55a // indirect
        github.com/klauspost/compress v1.11.1 // indirect
        github.com/mitchellh/mapstructure v1.3.3 // indirect
        github.com/qydysky/bili_danmu v0.0.0
index 5edccbc0732b40195134b7d7d4abb5b7356b8e46..7cd8b99fdc9b0f27d53c7d562d7221b9abb47c80 100644 (file)
@@ -15,6 +15,8 @@ github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0U
 github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
 github.com/gotk3/gotk3 v0.5.0 h1:GOkq4cFgAfeK6YAukLi64bz8zPayZKeCSSRr4mcFReQ=
 github.com/gotk3/gotk3 v0.5.0/go.mod h1:/hqFpkNa9T3JgNAE2fLvCdov7c5bw//FHNZrZ3Uv9/Q=
+github.com/gotk3/gotk3 v0.5.1-0.20201028052159-952547abf55a h1:9O8VeGmNRqh8UPYLfjYc+W3Gu7vSVTo2uEswq4FO9xI=
+github.com/gotk3/gotk3 v0.5.1-0.20201028052159-952547abf55a/go.mod h1:/hqFpkNa9T3JgNAE2fLvCdov7c5bw//FHNZrZ3Uv9/Q=
 github.com/klauspost/compress v1.10.10/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
 github.com/klauspost/compress v1.11.0 h1:wJbzvpYMVGG9iTI9VxpnNZfd4DzMPoCWze3GgSqz8yg=
 github.com/klauspost/compress v1.11.0/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=