mirror of
https://github.com/issadarkthing/gomu.git
synced 2025-04-25 13:48:49 +08:00
Minor fix for GoLint warnings
This commit is contained in:
parent
bf37032a94
commit
6e5e78e917
@ -8,6 +8,7 @@ import (
|
||||
"github.com/rivo/tview"
|
||||
)
|
||||
|
||||
// Colors are the configurable colors used in gomu
|
||||
type Colors struct {
|
||||
accent tcell.Color
|
||||
background tcell.Color
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
"github.com/ztrue/tracerr"
|
||||
)
|
||||
|
||||
// Command map string to actual command function
|
||||
type Command struct {
|
||||
commands map[string]func()
|
||||
}
|
||||
|
2
gomu.go
2
gomu.go
@ -9,10 +9,12 @@ import (
|
||||
"github.com/issadarkthing/gomu/player"
|
||||
)
|
||||
|
||||
// VERSION is version information of gomu
|
||||
var VERSION = "N/A"
|
||||
|
||||
var gomu *Gomu
|
||||
|
||||
// Gomu is the application from tview
|
||||
type Gomu struct {
|
||||
app *tview.Application
|
||||
playingBar *PlayingBar
|
||||
|
@ -28,6 +28,7 @@ import (
|
||||
"github.com/ztrue/tracerr"
|
||||
)
|
||||
|
||||
// Lyric contains UnsyncedCaptions and SyncedCaptions
|
||||
type Lyric struct {
|
||||
Album string
|
||||
Artist string
|
||||
@ -41,6 +42,7 @@ type Lyric struct {
|
||||
SyncedCaptions []id3v2.SyncedText // SYLT captions
|
||||
}
|
||||
|
||||
// UnsyncedCaption is only showing in tageditor
|
||||
type UnsyncedCaption struct {
|
||||
Timestamp uint32
|
||||
Text string
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// SongTag is the tag information for songs
|
||||
type SongTag struct {
|
||||
Artist string
|
||||
Title string
|
||||
|
@ -36,6 +36,7 @@ type tagKugou struct {
|
||||
URLID string `json:"url_id"`
|
||||
}
|
||||
|
||||
// tagLyric is the lyric json get from both netease and kugou
|
||||
type tagLyric struct {
|
||||
Lyric string `json:"lyric"`
|
||||
Tlyric string `json:"tlyric"`
|
||||
|
@ -16,6 +16,7 @@ import (
|
||||
"github.com/issadarkthing/gomu/lyric"
|
||||
)
|
||||
|
||||
// PlayingBar shows song name, progress and lyric
|
||||
type PlayingBar struct {
|
||||
*tview.Frame
|
||||
full int
|
||||
|
@ -38,22 +38,27 @@ type AudioFile struct {
|
||||
parent *tview.TreeNode
|
||||
}
|
||||
|
||||
// Name return the name of AudioFile
|
||||
func (a *AudioFile) Name() string {
|
||||
return a.name
|
||||
}
|
||||
|
||||
// Path return the path of AudioFile
|
||||
func (a *AudioFile) Path() string {
|
||||
return a.path
|
||||
}
|
||||
|
||||
// IsAudioFile check if the file is song or directory
|
||||
func (a *AudioFile) IsAudioFile() bool {
|
||||
return a.isAudioFile
|
||||
}
|
||||
|
||||
// Len return the length of AudioFile
|
||||
func (a *AudioFile) Len() time.Duration {
|
||||
return a.length
|
||||
}
|
||||
|
||||
// GetParent return the parent directory of AudioFile
|
||||
func (a *AudioFile) GetParent() *AudioFile {
|
||||
if a.parent == nil {
|
||||
return nil
|
||||
@ -524,7 +529,7 @@ Download:
|
||||
|
||||
select {
|
||||
case <-p.done:
|
||||
p.download -= 1
|
||||
p.download--
|
||||
if p.download == 0 {
|
||||
p.SetTitle(p.defaultTitle)
|
||||
break Download
|
||||
|
23
popup.go
23
popup.go
@ -631,7 +631,7 @@ func inputPopup(prompt, placeholder string, handler func(string)) {
|
||||
|
||||
func replPopup() {
|
||||
|
||||
popupId := "repl-input-popup"
|
||||
popupID := "repl-input-popup"
|
||||
prompt := "> "
|
||||
|
||||
textview := tview.NewTextView()
|
||||
@ -669,7 +669,7 @@ func replPopup() {
|
||||
if upCount == len(history) {
|
||||
upCount -= 2
|
||||
} else {
|
||||
upCount -= 1
|
||||
upCount--
|
||||
}
|
||||
input.SetText(history[upCount])
|
||||
} else if upCount == 0 {
|
||||
@ -680,7 +680,7 @@ func replPopup() {
|
||||
textview.SetText("")
|
||||
|
||||
case tcell.KeyEsc:
|
||||
gomu.pages.RemovePage(popupId)
|
||||
gomu.pages.RemovePage(popupID)
|
||||
gomu.popups.pop()
|
||||
return nil
|
||||
|
||||
@ -704,9 +704,8 @@ func replPopup() {
|
||||
if err != nil {
|
||||
fmt.Fprintf(textview, "%v\n\n", err)
|
||||
return nil
|
||||
} else {
|
||||
fmt.Fprintf(textview, "%v\n\n", res)
|
||||
}
|
||||
fmt.Fprintf(textview, "%v\n\n", res)
|
||||
|
||||
}
|
||||
|
||||
@ -732,9 +731,9 @@ func replPopup() {
|
||||
|
||||
func ytSearchPopup() {
|
||||
|
||||
popupId := "youtube-search-input-popup"
|
||||
popupID := "youtube-search-input-popup"
|
||||
|
||||
input := newInputPopup(popupId, " Youtube Search ", "search: ", "")
|
||||
input := newInputPopup(popupID, " Youtube Search ", "search: ", "")
|
||||
|
||||
instance := gomu.anko.GetString("General.invidious_instance")
|
||||
inv := invidious.Invidious{Domain: instance}
|
||||
@ -783,7 +782,7 @@ func ytSearchPopup() {
|
||||
case tcell.KeyEnter:
|
||||
search := input.GetText()
|
||||
defaultTimedPopup(" Youtube Search ", "Searching for "+search)
|
||||
gomu.pages.RemovePage(popupId)
|
||||
gomu.pages.RemovePage(popupID)
|
||||
gomu.popups.pop()
|
||||
|
||||
go func() {
|
||||
@ -839,7 +838,7 @@ func ytSearchPopup() {
|
||||
}()
|
||||
|
||||
case tcell.KeyEscape:
|
||||
gomu.pages.RemovePage(popupId)
|
||||
gomu.pages.RemovePage(popupID)
|
||||
gomu.popups.pop()
|
||||
gomu.app.SetFocus(gomu.prevPanel.(tview.Primitive))
|
||||
|
||||
@ -893,11 +892,9 @@ func lyricPopup(lang string, audioFile *AudioFile, wg *sync.WaitGroup) error {
|
||||
errorPopup(err)
|
||||
gomu.app.Draw()
|
||||
return
|
||||
} else {
|
||||
infoPopup(lang + " lyric added successfully")
|
||||
gomu.app.Draw()
|
||||
return
|
||||
}
|
||||
infoPopup(lang + " lyric added successfully")
|
||||
gomu.app.Draw()
|
||||
|
||||
}()
|
||||
})
|
||||
|
2
queue.go
2
queue.go
@ -19,6 +19,7 @@ import (
|
||||
"github.com/ztrue/tracerr"
|
||||
)
|
||||
|
||||
// Queue shows queued songs for playing
|
||||
type Queue struct {
|
||||
*tview.List
|
||||
savedQueuePath string
|
||||
@ -365,7 +366,6 @@ func newQueue() *Queue {
|
||||
savedQueuePath: cacheQueuePath,
|
||||
}
|
||||
|
||||
|
||||
cmds := map[rune]string{
|
||||
'j': "move_down",
|
||||
'k': "move_up",
|
||||
|
1
start.go
1
start.go
@ -38,6 +38,7 @@ const (
|
||||
musicPath = "~/music"
|
||||
)
|
||||
|
||||
// Args is the augs for gomu executable
|
||||
type Args struct {
|
||||
config *string
|
||||
empty *bool
|
||||
|
11
tageditor.go
11
tageditor.go
@ -109,9 +109,8 @@ func tagPopup(node *AudioFile) (err error) {
|
||||
if err != nil {
|
||||
errorPopup(err)
|
||||
return
|
||||
} else {
|
||||
defaultTimedPopup(" Success ", "Tag update successfully")
|
||||
}
|
||||
defaultTimedPopup(" Success ", "Tag update successfully")
|
||||
})
|
||||
}()
|
||||
}).
|
||||
@ -135,9 +134,9 @@ func tagPopup(node *AudioFile) (err error) {
|
||||
if err != nil {
|
||||
errorPopup(err)
|
||||
return
|
||||
} else {
|
||||
defaultTimedPopup(" Success ", "Tag update successfully")
|
||||
}
|
||||
defaultTimedPopup(" Success ", "Tag update successfully")
|
||||
|
||||
}).
|
||||
SetBackgroundColorActivated(gomu.colors.popup).
|
||||
SetLabelColorActivated(gomu.colors.accent).
|
||||
@ -167,9 +166,9 @@ func tagPopup(node *AudioFile) (err error) {
|
||||
if err != nil {
|
||||
errorPopup(err)
|
||||
return
|
||||
} else {
|
||||
infoPopup(langExt + " lyric deleted successfully.")
|
||||
}
|
||||
infoPopup(langExt + " lyric deleted successfully.")
|
||||
|
||||
// Update map
|
||||
delete(popupLyricMap, langExt)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user