Merge remote-tracking branch 'upstream/master'

This commit is contained in:
tramhao 2021-03-16 01:01:05 +08:00
commit eea825e9d3
8 changed files with 61 additions and 26 deletions

5
go.mod
View File

@ -13,7 +13,7 @@ require (
github.com/asmcos/requests v0.0.0-20210118082303-cb8f46dd3767
github.com/bogem/id3v2 v1.2.0
github.com/faiface/beep v1.0.2
github.com/gdamore/tcell/v2 v2.1.0
github.com/gdamore/tcell/v2 v2.2.0
github.com/gobwas/glob v0.2.3 // indirect
github.com/gocolly/colly v1.2.0
github.com/hajimehoshi/go-mp3 v0.3.1 // indirect
@ -23,7 +23,7 @@ require (
github.com/logrusorgru/aurora v2.0.3+incompatible // indirect
github.com/mattn/anko v0.1.8
github.com/pkg/errors v0.9.1 // indirect
github.com/rivo/tview v0.0.0-20210125085121-dbc1f32bb1d0
github.com/rivo/tview v0.0.0-20210312174852-ae9464cc3598
github.com/sahilm/fuzzy v0.1.0
github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca // indirect
github.com/stretchr/testify v1.7.0
@ -33,5 +33,6 @@ require (
golang.org/x/exp v0.0.0-20201229011636-eab1b5eb1a03 // indirect
golang.org/x/image v0.0.0-20201208152932-35266b937fa6 // indirect
golang.org/x/net v0.0.0-20210119194325-5f4716e94777 // indirect
golang.org/x/sys v0.0.0-20210313202042-bd2e13477e9c // indirect
google.golang.org/appengine v1.6.7 // indirect
)

12
go.sum
View File

@ -26,6 +26,8 @@ github.com/gdamore/tcell v1.4.0/go.mod h1:vxEiSDZdW3L+Uhjii9c3375IlDmR05bzxY404Z
github.com/gdamore/tcell/v2 v2.0.1-0.20201017141208-acf90d56d591/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA=
github.com/gdamore/tcell/v2 v2.1.0 h1:UnSmozHgBkQi2PGsFr+rpdXuAPRRucMegpQp3Z3kDro=
github.com/gdamore/tcell/v2 v2.1.0/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA=
github.com/gdamore/tcell/v2 v2.2.0 h1:vSyEgKwraXPSOkvCk7IwOSyX+Pv3V2cV9CikJMXg4U4=
github.com/gdamore/tcell/v2 v2.2.0/go.mod h1:cTTuF84Dlj/RqmaCIV5p4w8uG1zWdk0SF6oBpwHp4fU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y=
github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
@ -59,6 +61,8 @@ github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/z
github.com/lucasb-eyer/go-colorful v0.0.0-20181028223441-12d3b2882a08/go.mod h1:NXg0ArsFk0Y01623LgUqoqcouGDB+PwCCQlrwrG6xJ4=
github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac=
github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/mattn/anko v0.1.8 h1:wDGM0Rwgbzhk1h8xE6qAR4n+PO/9clzf3tLGtrwsqJg=
github.com/mattn/anko v0.1.8/go.mod h1:C5D2zw4NIv/sB2SrQ3qs5wqPw0wKiA2GZqexy4ctNH0=
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
@ -73,6 +77,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rivo/tview v0.0.0-20210125085121-dbc1f32bb1d0 h1:WCfp+Jq9Mx156zIf9X6Frd6F19rf7wIRlm54UPxUfcU=
github.com/rivo/tview v0.0.0-20210125085121-dbc1f32bb1d0/go.mod h1:1QW7hX7RQzOqyGgx8O64bRPQBrFtPflioPPX5gFPV3A=
github.com/rivo/tview v0.0.0-20210312174852-ae9464cc3598 h1:AbRrGXhagPRDItERv7nauBUUPi7Ma3IGIj9FqkQKW6k=
github.com/rivo/tview v0.0.0-20210312174852-ae9464cc3598/go.mod h1:VzCN9WX13RF88iH2CaGkmdHOlsy1ZZQcTmNwROqC+LI=
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
@ -143,7 +149,13 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210113181707-4bcb84eeeb78 h1:nVuTkr9L6Bq62qpUqKo/RnZCFfzDBL0bYo6w9OJUqZY=
golang.org/x/sys v0.0.0-20210113181707-4bcb84eeeb78/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210313202042-bd2e13477e9c h1:coiPEfMv+ThsjULRDygLrJVlNE1gDdL2g65s0LhV2os=
golang.org/x/sys v0.0.0-20210313202042-bd2e13477e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d h1:SZxvLBoTP5yHO3Frd4z4vrF+DBX9vMVanchswa69toE=
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=

View File

@ -36,8 +36,11 @@ func (p *PlayingBar) help() []string {
func newPlayingBar() *PlayingBar {
textView := tview.NewTextView().SetTextAlign(tview.AlignCenter)
textView.SetBackgroundColor(gomu.colors.background)
frame := tview.NewFrame(textView).SetBorders(1, 1, 1, 1, 1, 1)
frame.SetBorder(true).SetTitle(" Now Playing ")
frame.SetBackgroundColor(gomu.colors.background)
p := &PlayingBar{
Frame: frame,

View File

@ -115,6 +115,7 @@ func newPlaylist(args Args) *Playlist {
SetColor(gomu.colors.accent)
tree := tview.NewTreeView().SetRoot(root)
tree.SetBackgroundColor(gomu.colors.background)
playlist := &Playlist{
TreeView: tree,

View File

@ -411,6 +411,7 @@ func searchPopup(title string, stringsToMatch []string, handler func(selected st
list := tview.NewList().ShowSecondaryText(false)
list.SetSelectedBackgroundColor(gomu.colors.accent)
list.SetHighlightFullLine(true)
list.SetBackgroundColor(gomu.colors.popup)
for _, v := range stringsToMatch {
list.AddItem(v, v, 0, nil)
@ -501,11 +502,13 @@ func searchPopup(title string, stringsToMatch []string, handler func(selected st
AddItem(input, 2, 1, true).
AddItem(list, 0, 1, false)
popup.SetBorder(true).
popupBox := tview.NewBox().SetBorder(true).
SetBackgroundColor(gomu.colors.popup).
SetBorderPadding(1, 1, 2, 2).
SetTitle(" " + title + " ")
popup.Box = popupBox
gomu.pages.AddPage("search-input-popup", center(popup, 70, 40), true, true)
gomu.popups.push(popup)
}
@ -709,12 +712,14 @@ func replPopup() {
AddItem(input, 3, 1, true).
AddItem(textview, 0, 1, false)
flex.
flexBox := tview.NewBox().
SetBackgroundColor(gomu.colors.popup).
SetBorder(true).
SetBorderPadding(1, 1, 2, 2).
SetTitle(" REPL ")
flex.Box = flexBox
gomu.pages.AddPage(popupId, center(flex, 90, 30), true, true)
gomu.popups.push(flex)
}

View File

@ -361,6 +361,8 @@ func newQueue() *Queue {
list := tview.NewList().
ShowSecondaryText(false)
list.SetBackgroundColor(gomu.colors.background)
queue := &Queue{
List: list,
savedQueuePath: cacheQueuePath,

View File

@ -317,7 +317,7 @@ func start(application *tview.Application, args Args) {
tview.Borders.TopRightFocus = tview.Borders.TopRight
tview.Borders.BottomLeftFocus = tview.Borders.BottomLeft
tview.Borders.BottomRightFocus = tview.Borders.BottomRight
tview.Styles.PrimitiveBackgroundColor = gomu.colors.background
tview.Styles.PrimitiveBackgroundColor = gomu.colors.popup
gomu.initPanels(application, args)

View File

@ -45,21 +45,22 @@ func tagPopup(node *AudioFile) (err error) {
leftGrid *tview.Grid = tview.NewGrid()
rightFlex *tview.Flex = tview.NewFlex()
)
artistInputField.SetLabel("Artist: ").
SetFieldWidth(20).
SetText(tag.Artist()).
SetFieldBackgroundColor(gomu.colors.popup).
SetBackgroundColor(gomu.colors.background)
SetFieldBackgroundColor(gomu.colors.popup)
titleInputField.SetLabel("Title: ").
SetFieldWidth(20).
SetText(tag.Title()).
SetFieldBackgroundColor(gomu.colors.popup).
SetBackgroundColor(gomu.colors.background)
SetFieldBackgroundColor(gomu.colors.popup)
albumInputField.SetLabel("Album: ").
SetFieldWidth(20).
SetText(tag.Album()).
SetFieldBackgroundColor(gomu.colors.popup).
SetBackgroundColor(gomu.colors.background)
SetFieldBackgroundColor(gomu.colors.popup)
getTagButton.SetSelectedFunc(func() {
var titles []string
audioFile := node
@ -107,9 +108,12 @@ func tagPopup(node *AudioFile) (err error) {
}
})
}).
SetBackgroundColorActivated(gomu.colors.popup).
SetLabelColorActivated(gomu.colors.accent).
SetBorder(true).
SetBackgroundColor(gomu.colors.background).
SetBackgroundColor(gomu.colors.popup).
SetTitleColor(gomu.colors.accent)
saveTagButton.SetSelectedFunc(func() {
tag, err = id3v2.Open(node.path, id3v2.Options{Parse: true})
if err != nil {
@ -126,13 +130,15 @@ func tagPopup(node *AudioFile) (err error) {
defaultTimedPopup(" Success ", "Tag update successfully")
}
}).
SetBackgroundColorActivated(gomu.colors.popup).
SetLabelColorActivated(gomu.colors.accent).
SetBorder(true).
SetBackgroundColor(gomu.colors.background).
SetBackgroundColor(gomu.colors.popup).
SetTitleColor(gomu.colors.foreground)
lyricDropDown.SetOptions(options, nil).
SetCurrentOption(0).
SetFieldBackgroundColor(gomu.colors.background).
SetFieldBackgroundColor(gomu.colors.popup).
SetFieldTextColor(gomu.colors.accent).
SetPrefixTextColor(gomu.colors.accent).
SetSelectedFunc(func(text string, _ int) {
@ -187,18 +193,21 @@ func tagPopup(node *AudioFile) (err error) {
infoPopup("No lyric embeded.")
}
}).
SetBackgroundColorActivated(gomu.colors.popup).
SetLabelColorActivated(gomu.colors.accent).
SetBorder(true).
SetBackgroundColor(gomu.colors.background).
SetBackgroundColor(gomu.colors.popup).
SetTitleColor(gomu.colors.accent)
getLyricDropDownOptions := []string{"en", "zh-CN"}
getLyricDropDown.SetOptions(getLyricDropDownOptions, nil).
SetCurrentOption(0).
SetFieldBackgroundColor(gomu.colors.background).
SetFieldBackgroundColor(gomu.colors.popup).
SetFieldTextColor(gomu.colors.accent).
SetPrefixTextColor(gomu.colors.accent).
SetLabel("Fetch Lyrics: ")
getLyricDropDown.SetBackgroundColor(gomu.colors.popup)
SetLabel("Fetch Lyrics: ").
SetBackgroundColor(gomu.colors.popup)
langLyricFromConfig := gomu.anko.GetString("General.lang_lyric")
if strings.Contains(langLyricFromConfig, "zh-CN") {
getLyricDropDown.SetCurrentOption(1)
@ -295,9 +304,11 @@ func tagPopup(node *AudioFile) (err error) {
gomu.app.Draw()
}
}).
SetBackgroundColorActivated(gomu.colors.popup).
SetLabelColorActivated(gomu.colors.accent).
SetBorder(true).
SetBackgroundColor(gomu.colors.background).
SetTitleColor(gomu.colors.accent)
SetTitleColor(gomu.colors.accent).
SetBackgroundColor(gomu.colors.popup)
var lyricText string
_, langExt := lyricDropDown.GetCurrentOption()
@ -318,7 +329,6 @@ func tagPopup(node *AudioFile) (err error) {
SetScrollable(true).
SetWordWrap(true).
SetWrap(true).
SetBackgroundColor(gomu.colors.popup).
SetBorder(true)
leftGrid.SetRows(3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3).
@ -332,10 +342,13 @@ func tagPopup(node *AudioFile) (err error) {
AddItem(deleteLyricButton, 7, 0, 1, 3, 1, 10, true).
AddItem(getLyricDropDown, 9, 0, 1, 3, 1, 20, true).
AddItem(getLyricButton, 10, 0, 1, 3, 1, 10, true)
leftGrid.SetBorder(true).
box := tview.NewBox().SetBorder(true).
SetTitle(node.name).
SetBorderPadding(1, 1, 2, 2)
leftGrid.Box = box
rightFlex.SetDirection(tview.FlexColumn).
AddItem(lyricTextView, 0, 1, true)
@ -348,8 +361,7 @@ func tagPopup(node *AudioFile) (err error) {
lyricFlex.
SetTitle(node.name).
SetBorderPadding(1, 1, 1, 1).
SetBackgroundColor(gomu.colors.popup)
SetBorderPadding(1, 1, 1, 1)
inputs := []tview.Primitive{
artistInputField,
@ -364,8 +376,7 @@ func tagPopup(node *AudioFile) (err error) {
lyricTextView,
}
gomu.pages.
AddPage(popupID, center(lyricFlex, 90, 40), true, true)
gomu.pages.AddPage(popupID, center(lyricFlex, 90, 40), true, true)
gomu.popups.push(lyricFlex)
lyricFlex.SetInputCapture(func(e *tcell.EventKey) *tcell.EventKey {