branches:
- '**'
- '!master'
- paths:
- - 'VERSION'
jobs:
-
- ubuntu_build:
- name: ubuntu_build
+ u-build:
+ name: build_ubuntu_go${{ matrix.go }}
runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ go: [ '1.15' ]
steps:
-
- - name: Set up Go
+ - name: Set up Go${{ matrix.go }}
uses: actions/setup-go@v2
with:
- go-version: ^1.15.4
- id: go
+ go-version: ${{ matrix.go }}
- name: Check out code
uses: actions/checkout@v2
-
+
- name: Build
run: |
sudo apt-get install libgtk-3-dev libcairo2-dev libglib2.0-dev
go get github.com/gotk3/gotk3@master
- go build -v -buildmode=exe -o demo/demo.run -tags gtk_3_22 -i demo/main.go
+ go build -v -buildmode=exe -tags gtk_3_22 -o demo/demo.run -i demo/main.go
- name: zip
- run: zip -q -r release_ubuntu.zip *
+ run: zip -q -r ubuntu_go${{ matrix.go }}.zip *
- name: Upload a Build Artifact
uses: actions/upload-artifact@v2.2.0
with:
- path: ./release_ubuntu.zip
-
- windows_build:
- name: windows_build
+ path: ./ubuntu_go${{ matrix.go }}.zip
+
+ w-build:
+ name: build_windows_go${{ matrix.go }}
runs-on: windows-latest
+ strategy:
+ matrix:
+ go: [ '1.15' ]
steps:
-
- - name: Set up Go
+ - name: Set up Go${{ matrix.go }}
uses: actions/setup-go@v2
with:
- go-version: ^1.15.4
- id: go
-
+ go-version: ${{ matrix.go }}
+
- name: Set up C
run: |
echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH
- name: Check out code
uses: actions/checkout@v2
-
- - shell: msys2 {0}
+
+ - name: Build
+ shell: msys2 {0}
run: |
- export CGO_LDFLAGS_ALLOW="-Wl.*"
- export CGO_CFLAGS_ALLOW="-Wl.*"
- export CGO_CXXFLAGS_ALLOW="-Wl.*"
go get github.com/gotk3/gotk3@master
- go build -v -buildmode=exe -o demo/demo.exe -tags gtk_3_22 -i demo/main.go
-
+ go build -v -buildmode=exe -tags gtk_3_22 -o demo/demo.exe -i demo/main.go
+
- name: zip
- run: .\7za.exe a -r .\release_windows.zip ./
-
+ run: .\7za.exe a -r .\windows_go${{ matrix.go }}.zip ./
+
- name: Upload a Build Artifact
uses: actions/upload-artifact@v2.2.0
with:
- path: ./release_windows.zip
+ path: ./windows_go${{ matrix.go }}.zip
//功能开关
var AllF = map[string]bool{
- "Qtd":false,//Qt弹幕窗口
"Gtk":false,//Gtk弹幕窗口
"Saveflv":true,//保存直播流(默认高清,有cookie默认蓝光)
"Ass":true,//Ass弹幕生成,由于时间对应关系,仅开启流保存时生效
Gtk_danmu()
}
-//Qtd 弹幕Qt窗口
-type Qtd struct {
- Qt_MaxMun int
- Qt_LineHeight float64
- Qt_BlockMargin float64
- Qt_FontSize int
- Qt_FontWeight int
- Qt_Background []int
-}
-
-var qtd = 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(){
- if !IsOn("Qtd") {return}
- Qtdanmu()
-}
-
//Ass 弹幕转字幕
type Ass struct {
+++ /dev/null
-package reply
-
-import (
- "os"
- "strconv"
- "os/signal"
-
- c "github.com/qydysky/bili_danmu/CV"
- "github.com/therecipe/qt/core"
- "github.com/therecipe/qt/gui"
- "github.com/therecipe/qt/widgets"
-)
-
-var (
- centralLayout *widgets.QGridLayout
- QtDanmuChan chan string
- QtOn bool
- 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}
- defer func() {
- if err := recover(); err != nil {os.Exit(0)}
- }()
- 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
-
- wq := widgets.NewQApplication(len(os.Args), os.Args)
-
- //主窗口
- mainWindow := widgets.NewQMainWindow(nil, 0)
- mainWindow.SetWindowTitle("danmu")
- mainWindow.SetSizePolicy2(widgets.QSizePolicy__Maximum, widgets.QSizePolicy__Maximum)
- mainWindow.SetContentsMargins(0, 0, 0, 0)
- mainWindow.SetWindowOpacity(1)
- mainWindow.SetAttribute(core.Qt__WA_TranslucentBackground, true)
- {
- Qp := gui.NewQPalette()
- Qp.SetColor2(gui.QPalette__Background, gui.NewQColor3(0, 0, 0, 0));
- mainWindow.SetPalette(Qp)
- }
-
- centralWidget := widgets.NewQWidget(nil, 0)
- centralWidget.SetContentsMargins(0, 0, 0, 0)
- {
- Qp := gui.NewQPalette()
- Qp.SetColor2(gui.QPalette__Background, gui.NewQColor3(0, 0, 0, 0));
- centralWidget.SetPalette(Qp)
- }
-
-
- vbox := widgets.NewQGridLayout(centralWidget)
- t := new(centralWidget, vbox)
-
- centralWidget.SetLayout(vbox)
- mainWindow.SetCentralWidget(centralWidget)
- mainWindow.ShowNormalDefault()
- wq.SetActiveWindow(mainWindow)
- go func(){
- QtDanmuChan = make(chan string, 10)
- QtOn = true
- // var list []string
- t.TextCursor().InsertText("房间:" + strconv.Itoa(c.Roomid))
- text(c.Title, t)
- for QtOn {
- select{
- case i :=<-QtDanmuChan:
- text(i, t)
- }
- }
- }()
-
- //ctrl+c退出
- interrupt := make(chan os.Signal, 1)
- signal.Notify(interrupt, os.Interrupt)
- go func(w *widgets.QApplication){
- <-interrupt
- close(interrupt)
- w.CloseAllWindows()
- }(wq)
- wq.Exec()
- QtOn = false
-}
-
-func new(pare *widgets.QWidget, layouts *widgets.QGridLayout) (t *widgets.QTextEdit) {
- t = widgets.NewQTextEdit(pare)
- {
- Qp := gui.NewQPalette()
- 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)
- t.SetWordWrapMode(gui.QTextOption__WrapAnywhere)
- // t.SetBackgroundVisible(true)
- // 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(Qt_FontSize)
- f.SetWeight(Qt_FontWeight)
- t.SetCurrentFont(f)
- }
- {
- tc := t.TextCursor()
- b := tc.BlockFormat()
- b.SetLineHeight(Qt_LineHeight, int(gui.QTextBlockFormat__ProportionalHeight))
- b.SetBottomMargin(Qt_BlockMargin)
- tc.SetBlockFormat(b)
- t.SetTextCursor(tc)
- }
- layouts.AddWidget2(t, layouts.RowCount(), 0, 0)
- return
-}
-
-func text(s string, pare *widgets.QTextEdit) {
- c := pare.TextCursor()
- if c.HasSelection() {return}//用户选择,暂停
- c.MovePosition(gui.QTextCursor__End, gui.QTextCursor__MoveAnchor, 1)
- c.InsertBlock()
- c.BeginEditBlock()
- c.InsertText(s)
- c.EndEditBlock()
- if pare.Document().BlockCount() > Qt_MaxMun {
- c.MovePosition(gui.QTextCursor__Start, gui.QTextCursor__MoveAnchor, 1)
- // c.BeginEditBlock()
- c.MovePosition(gui.QTextCursor__NextBlock, gui.QTextCursor__KeepAnchor, 1)
- // c.Select(gui.QTextCursor__BlockUnderCursor)
- c.RemoveSelectedText()
- // c.EndEditBlock()
- c.MovePosition(gui.QTextCursor__End, gui.QTextCursor__MoveAnchor, 1)
- }
- // t := pare.ToPlainText()
- pare.SetTextCursor(c)
-
- pare.EnsureCursorVisible()
- // pare.SetPlainText(s + "\n" + t)
-}