]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
28
authorqydysky <qydysky@foxmail.com>
Sat, 3 Oct 2020 00:17:56 +0000 (08:17 +0800)
committerqydysky <qydysky@foxmail.com>
Sat, 3 Oct 2020 00:17:56 +0000 (08:17 +0800)
CV/Const.go
CV/Var.go
F/api.go
Reply/F.go
Reply/Reply.go
Reply/qt.go

index b293761001f6bba2c6129a0df22659c165732bfa..9892427b72c684e436e4f937bed1411bef3bf712 100644 (file)
@@ -34,6 +34,5 @@ const (
        Uid = 0
        Protover = 2
        Platform = "web"
-       VERSION = "2.0.11"
        Type = 2
 )
\ No newline at end of file
index 311046e01cefdd72bbb8870bbcb43186741a7c94..f492b48b33c7472962cfebeb7e341613c7f7c24f 100644 (file)
--- a/CV/Var.go
+++ b/CV/Var.go
@@ -4,4 +4,12 @@ var (
        Live string//直播链接
        Roomid int
        Cookie string
+)
+
+//from player-loader-2.0.11.min.js
+/*
+       customAuthParam
+*/
+var (
+       VERSION = "2.0.11"
 )
\ No newline at end of file
index 9d1f18826d03517259ab9a976bb2eede22d8f5fe..bf0bf59bf84b80abf00243e27028a467b0ca9d69 100644 (file)
--- a/F/api.go
+++ b/F/api.go
@@ -53,6 +53,11 @@ func (i *api) Get_info() (o *api) {
        } else {
                o.Uid = i
        }
+       //VERSION
+       if e := r.S(`player-loader-`, `.min`, 0, 0).Err;e == nil {
+               c.VERSION = r.RS
+       }
+       apilog.W("api version", c.VERSION)
        //roomid
        if tmp := r.S(`"room_id":`, `,`, 0, 0);tmp.Err != nil {
                // apilog.E("room_id", tmp.Err)
@@ -136,6 +141,10 @@ func (i *api) Get_live() (o *api) {
                                return
                        }
                }
+               if e := r.S(`player-loader-`, `.min`, 0, 0).Err;e == nil {
+                       c.VERSION = r.RS
+               }
+               apilog.W("api version", c.VERSION)
        }
        {//api获取
                req := p.Req()
index 65c0016b0381e202a255e404e49c7552c3b51be6..558001861d99441e8dcc6554dae1f41c6530ca99 100644 (file)
@@ -113,10 +113,33 @@ func selfcross2(a []string) (float32, string) {
 //Qtd 弹幕Qt窗口
 type Qtd struct {
        Inuse bool
+       Qt_MaxMun int 
+       Qt_LineHeight float64 
+       Qt_BlockMargin float64 
+       Qt_FontSize int 
+       Qt_FontWeight int 
+       Qt_Background []int 
 }
 
 var qtd = Qtd {
        Inuse:IsOn("Qtd"),
+       Qt_MaxMun:30,//danmu max limit
+       Qt_LineHeight:90,//percent
+       Qt_BlockMargin:7,
+       Qt_FontSize:16,//pixel
+       Qt_FontWeight:57,
+       /*
+       QFont__Thin       QFont__Weight = QFont__Weight(0)
+       QFont__ExtraLight QFont__Weight = QFont__Weight(12)
+       QFont__Light      QFont__Weight = QFont__Weight(25)
+       QFont__Normal     QFont__Weight = QFont__Weight(50)
+       QFont__Medium     QFont__Weight = QFont__Weight(57)
+       QFont__DemiBold   QFont__Weight = QFont__Weight(63)
+       QFont__Bold       QFont__Weight = QFont__Weight(75)
+       QFont__ExtraBold  QFont__Weight = QFont__Weight(81)
+       QFont__Black      QFont__Weight = QFont__Weight(87)
+       */
+       Qt_Background:[]int{0, 0, 0, 140},//rgba
 }
 
 func Qtdf(){
@@ -288,13 +311,15 @@ func Saveflvf(){
                if p.Checkfile().IsExist(saveflv.path+".flv"){
                        l.I("转码中")
                        p.Exec().Run(false, "ffmpeg", "-i", saveflv.path+".flv", "-c", "copy", saveflv.path+".mkv")
-                       os.Remove(saveflv.path+".flv")
+                       // os.Remove(saveflv.path+".flv")
                }
 
                l.I("转码结束")
                saveflv.wait.Done()
                saveflv.cancel.Done()
        }
+       saveflv.wait.Done()
+       saveflv.cancel.Done()
 }
 
 //已func形式调用,将会停止保存直播流
index a3415bcc6c6fac223a5db4c4b8d510c91d798517..e6bc9731f5a1f473e57c70bcf05c80f9e8f822ef 100644 (file)
@@ -401,20 +401,22 @@ func (replyF) super_chat_message(s string){
        }
        fmt.Println("\n====")
        fmt.Println(sh...)
+       Qtshow("\n====")
+       Qtshow(Itos(sh))
        if message != nil && message.(string) != ""{
                fmt.Println(message)
+               Qtshow(message.(string))
                sh = append(sh, message)
        }
        if message_jpn != nil && message.(string) != message_jpn.(string) && message_jpn.(string) != "" {
                fmt.Println(message_jpn)
+               Qtshow(message_jpn.(string))
                sh = append(sh, message_jpn)
        }
        fmt.Print("====\n\n")
        
        {//额外
                Assf(fmt.Sprintln(sh...))
-               Qtshow("\n====")
-               Qtshow(Itos(sh))
                Qtshow("====\n")
        }
        msglog.Base(1, "礼").Fileonly(true).I(sh...).Fileonly(false)
@@ -552,6 +554,7 @@ func Itos(i []interface{}) string {
                case float64: r+= strconv.Itoa(int(v.(float64)))
                default:fmt.Println("unkonw type", v)
                }
+               i += " "
        }
        return r
 }
\ No newline at end of file
index c644937de68f92e46f6474bdf2b6621dce05b403..636ba8f1cb59179a0fb391344b03851d995f83f8 100644 (file)
@@ -3,6 +3,7 @@ package reply
 import (
        "os"
 
+       c "github.com/qydysky/bili_danmu/CV"
        "github.com/therecipe/qt/core"
        "github.com/therecipe/qt/gui"
        "github.com/therecipe/qt/widgets"
@@ -15,9 +16,20 @@ var (
        Qt_MaxMun int = 30//danmu max limit
        Qt_LineHeight float64 = 90//percent
        Qt_BlockMargin float64 = 7
+       Qt_FontSize int = 18
+       Qt_FontWeight int = 63
+       Qt_Background []int = []int{0, 0, 0, 140}//rgba
 )
 
 func Qtdanmu() {
+       if QtOn {return}
+       Qt_MaxMun = qtd.Qt_MaxMun
+       Qt_LineHeight = qtd.Qt_LineHeight
+       Qt_BlockMargin = qtd.Qt_BlockMargin
+       Qt_FontSize = qtd.Qt_FontSize
+       Qt_FontWeight = qtd.Qt_FontWeight
+       Qt_Background = qtd.Qt_Background
+
        widgets.NewQApplication(len(os.Args), os.Args)
 
        //主窗口
@@ -53,7 +65,7 @@ func Qtdanmu() {
                QtDanmuChan = make(chan string, 10)
                QtOn = true
                // var list []string
-               t.TextCursor().InsertText("==开始==")
+               t.TextCursor().InsertText("房间:", strconv.Itoa(c.Roomid))
                for QtOn {
                        select{
                        case i :=<-QtDanmuChan:
@@ -69,7 +81,8 @@ func new(pare *widgets.QWidget, layouts *widgets.QGridLayout) (t *widgets.QTextE
        t = widgets.NewQTextEdit(pare)
        {
                Qp := gui.NewQPalette()
-               Qp.SetColor2(gui.QPalette__Base, gui.NewQColor3(0, 0, 0, 140));
+               q := Qt_Background
+               Qp.SetColor2(gui.QPalette__Base, gui.NewQColor3(q[0], q[1], q[2], q[3]));
                t.SetPalette(Qp)
        }
        t.SetVerticalScrollBarPolicy(core.Qt__ScrollBarAlwaysOff)
@@ -78,13 +91,14 @@ func new(pare *widgets.QWidget, layouts *widgets.QGridLayout) (t *widgets.QTextE
        // t.SetMaximumBlockCount(100)
        t.SetContentsMargins(0, 0, 0, 0)
        // t.SetCenterOnScroll(false)
+       // t.SetTextInteractionFlags(core.Qt__TextEditable)
        t.SetReadOnly(true)
        {
                t.SetTextBackgroundColor(gui.NewQColor3(0, 0, 0, 0))
 
                f := gui.NewQFont()
-               f.SetPixelSize(18)
-               f.SetWeight(63)
+               f.SetPixelSize(Qt_FontSize)
+               f.SetWeight(Qt_FontWeight)
                t.SetCurrentFont(f)
        }
        {
@@ -101,6 +115,7 @@ func new(pare *widgets.QWidget, layouts *widgets.QGridLayout) (t *widgets.QTextE
 
 func text(s string, pare *widgets.QTextEdit) {
        c := pare.TextCursor()
+       c.MovePosition(gui.QTextCursor__End, gui.QTextCursor__MoveAnchor, 1)
        c.InsertBlock()
        c.BeginEditBlock()
        c.InsertText(s)
@@ -115,6 +130,7 @@ func text(s string, pare *widgets.QTextEdit) {
                c.MovePosition(gui.QTextCursor__End, gui.QTextCursor__MoveAnchor, 1)
        }
        // t := pare.ToPlainText()
+       pare.SetTextCursor(c)
 
        pare.EnsureCursorVisible()
        // pare.SetPlainText(s + "\n" + t)