From: qydysky Date: Sat, 3 Oct 2020 00:17:56 +0000 (+0800) Subject: 28 X-Git-Tag: v0.0.0~4 X-Git-Url: http://127.0.0.1:8081/?a=commitdiff_plain;h=c4abb288ac94568e610a306a49cf5f7cc1dd37c8;p=bili_danmu%2F.git 28 --- diff --git a/CV/Const.go b/CV/Const.go index b293761..9892427 100644 --- a/CV/Const.go +++ b/CV/Const.go @@ -34,6 +34,5 @@ const ( Uid = 0 Protover = 2 Platform = "web" - VERSION = "2.0.11" Type = 2 ) \ No newline at end of file diff --git a/CV/Var.go b/CV/Var.go index 311046e..f492b48 100644 --- 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 diff --git a/F/api.go b/F/api.go index 9d1f188..bf0bf59 100644 --- 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() diff --git a/Reply/F.go b/Reply/F.go index 65c0016..5580018 100644 --- a/Reply/F.go +++ b/Reply/F.go @@ -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形式调用,将会停止保存直播流 diff --git a/Reply/Reply.go b/Reply/Reply.go index a3415bc..e6bc973 100644 --- a/Reply/Reply.go +++ b/Reply/Reply.go @@ -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 diff --git a/Reply/qt.go b/Reply/qt.go index c644937..636ba8f 100644 --- a/Reply/qt.go +++ b/Reply/qt.go @@ -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)