mirror of
https://github.com/issadarkthing/gomu.git
synced 2025-04-26 13:49:21 +08:00
Fix:1.Get lyric dropdown 2. Typo in SongTag struct
This commit is contained in:
parent
f24f585e02
commit
45be5067f7
@ -15,7 +15,7 @@ type SongTag struct {
|
||||
LangExt string
|
||||
ServiceProvider string
|
||||
SongID string // SongID and LyricID is returned by cn server. It's not guaranteed to be identical
|
||||
LyridID string
|
||||
LyricID string
|
||||
}
|
||||
|
||||
// GetLyric should receive url that was returned from GetLyricOptions. GetLyric
|
||||
|
@ -49,7 +49,7 @@ func getLyricCn(songTag *SongTag) (string, error) {
|
||||
var lyric string
|
||||
p := requests.Params{
|
||||
"site": songTag.ServiceProvider,
|
||||
"lyric": songTag.LyridID,
|
||||
"lyric": songTag.LyricID,
|
||||
}
|
||||
req := requests.Requests()
|
||||
resp, err := req.Get("http://api.sunyj.xyz", p)
|
||||
@ -128,7 +128,7 @@ func getLyricOptionsCnByProvider(search string, serviceProvider string) ([]*Song
|
||||
LangExt: "zh-CN",
|
||||
ServiceProvider: serviceProvider,
|
||||
SongID: resultSongID,
|
||||
LyridID: resultLyricID,
|
||||
LyricID: resultLyricID,
|
||||
}
|
||||
resultTags = append(resultTags, songTag)
|
||||
}
|
||||
|
77
tageditor.go
77
tageditor.go
@ -30,8 +30,8 @@ func tagPopup(node *AudioFile) (err error) {
|
||||
saveTagButton *tview.Button = tview.NewButton("Save Tag")
|
||||
lyricDropDown *tview.DropDown = tview.NewDropDown()
|
||||
deleteLyricButton *tview.Button = tview.NewButton("Delete Lyric")
|
||||
getLyric1Button *tview.Button = tview.NewButton("Get Lyric 1(en)")
|
||||
getLyric2Button *tview.Button = tview.NewButton("Get Lyric 2(zh-CN)")
|
||||
getLyricDropDown *tview.DropDown = tview.NewDropDown()
|
||||
getLyricButton *tview.Button = tview.NewButton("Fetch Lyric")
|
||||
lyricTextView *tview.TextView
|
||||
leftGrid *tview.Grid = tview.NewGrid()
|
||||
rightFlex *tview.Flex = tview.NewFlex()
|
||||
@ -121,6 +121,18 @@ func tagPopup(node *AudioFile) (err error) {
|
||||
SetBackgroundColor(gomu.colors.background).
|
||||
SetTitleColor(gomu.colors.foreground)
|
||||
|
||||
lyricDropDown.SetOptions(options, nil).
|
||||
SetCurrentOption(0).
|
||||
SetFieldBackgroundColor(gomu.colors.background).
|
||||
SetFieldTextColor(gomu.colors.accent).
|
||||
SetPrefixTextColor(gomu.colors.accent).
|
||||
SetSelectedFunc(func(text string, _ int) {
|
||||
lyricTextView.SetText(popupLyricMap[text]).
|
||||
SetTitle(" " + text + " lyric preview ")
|
||||
}).
|
||||
SetLabel("Embeded Lyrics: ")
|
||||
lyricDropDown.SetBackgroundColor(gomu.colors.popup)
|
||||
|
||||
deleteLyricButton.SetSelectedFunc(func() {
|
||||
_, langExt := lyricDropDown.GetCurrentOption()
|
||||
if len(options) > 0 {
|
||||
@ -167,44 +179,29 @@ func tagPopup(node *AudioFile) (err error) {
|
||||
SetBackgroundColor(gomu.colors.background).
|
||||
SetTitleColor(gomu.colors.accent)
|
||||
|
||||
getLyric1Button.SetSelectedFunc(func() {
|
||||
|
||||
audioFile := gomu.playlist.getCurrentFile()
|
||||
lang := "en"
|
||||
err := getLyricFromTagEditor(audioFile, lang, lyricDropDown, lyricTextView)
|
||||
if err != nil {
|
||||
errorPopup(err)
|
||||
gomu.app.Draw()
|
||||
}
|
||||
}).
|
||||
SetBorder(true).
|
||||
SetBackgroundColor(gomu.colors.background).
|
||||
SetTitleColor(gomu.colors.accent)
|
||||
getLyric2Button.SetSelectedFunc(func() {
|
||||
audioFile := gomu.playlist.getCurrentFile()
|
||||
lang := "zh-CN"
|
||||
err := getLyricFromTagEditor(audioFile, lang, lyricDropDown, lyricTextView)
|
||||
if err != nil {
|
||||
errorPopup(err)
|
||||
gomu.app.Draw()
|
||||
}
|
||||
}).
|
||||
SetBorder(true).
|
||||
SetBackgroundColor(gomu.colors.background).
|
||||
SetTitleColor(gomu.colors.accent)
|
||||
|
||||
lyricDropDown.SetOptions(options, nil).
|
||||
getLyricDropDownOptions := []string{"en", "zh-CN"}
|
||||
getLyricDropDown.SetOptions(getLyricDropDownOptions, nil).
|
||||
SetCurrentOption(0).
|
||||
SetFieldBackgroundColor(gomu.colors.background).
|
||||
SetFieldTextColor(gomu.colors.accent).
|
||||
SetPrefixTextColor(gomu.colors.accent).
|
||||
SetSelectedFunc(func(text string, _ int) {
|
||||
lyricTextView.SetText(popupLyricMap[text]).
|
||||
SetTitle(" " + text + " lyric preview ")
|
||||
}).
|
||||
SetLabel("Embeded Lyrics: ")
|
||||
SetLabel("Fetch Lyrics: ")
|
||||
lyricDropDown.SetBackgroundColor(gomu.colors.popup)
|
||||
|
||||
getLyricButton.SetSelectedFunc(func() {
|
||||
|
||||
audioFile := gomu.playlist.getCurrentFile()
|
||||
_, lang := getLyricDropDown.GetCurrentOption()
|
||||
err := getLyricFromTagEditor(audioFile, lang, lyricDropDown, lyricTextView)
|
||||
if err != nil {
|
||||
errorPopup(err)
|
||||
gomu.app.Draw()
|
||||
}
|
||||
}).
|
||||
SetBorder(true).
|
||||
SetBackgroundColor(gomu.colors.background).
|
||||
SetTitleColor(gomu.colors.accent)
|
||||
|
||||
var lyricText string
|
||||
_, langExt := lyricDropDown.GetCurrentOption()
|
||||
lyricText = popupLyricMap[langExt]
|
||||
@ -227,7 +224,7 @@ func tagPopup(node *AudioFile) (err error) {
|
||||
SetBackgroundColor(gomu.colors.popup).
|
||||
SetBorder(true)
|
||||
|
||||
leftGrid.SetRows(3, 3, 3, 3, 3, 0, 3, 3, 3, 3).
|
||||
leftGrid.SetRows(3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3).
|
||||
SetColumns(30).
|
||||
AddItem(artistInputField, 0, 0, 1, 3, 1, 10, true).
|
||||
AddItem(titleInputField, 1, 0, 1, 3, 1, 10, true).
|
||||
@ -236,8 +233,8 @@ func tagPopup(node *AudioFile) (err error) {
|
||||
AddItem(saveTagButton, 4, 0, 1, 3, 1, 10, true).
|
||||
AddItem(lyricDropDown, 6, 0, 1, 3, 1, 10, true).
|
||||
AddItem(deleteLyricButton, 7, 0, 1, 3, 1, 10, true).
|
||||
AddItem(getLyric1Button, 8, 0, 1, 3, 1, 10, true).
|
||||
AddItem(getLyric2Button, 9, 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).
|
||||
SetTitle(node.name).
|
||||
SetBorderPadding(1, 1, 2, 2)
|
||||
@ -251,7 +248,7 @@ func tagPopup(node *AudioFile) (err error) {
|
||||
|
||||
lyricFlex.
|
||||
SetTitle(node.name).
|
||||
SetBorderPadding(1, 1, 2, 2).
|
||||
SetBorderPadding(1, 1, 1, 1).
|
||||
SetBackgroundColor(gomu.colors.popup)
|
||||
|
||||
inputs := []tview.Primitive{
|
||||
@ -262,8 +259,8 @@ func tagPopup(node *AudioFile) (err error) {
|
||||
saveTagButton,
|
||||
lyricDropDown,
|
||||
deleteLyricButton,
|
||||
getLyric1Button,
|
||||
getLyric2Button,
|
||||
getLyricDropDown,
|
||||
getLyricButton,
|
||||
lyricTextView,
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user