mirror of
https://github.com/issadarkthing/gomu.git
synced 2025-04-26 13:49:21 +08:00
add config option rename_bytag, fix bug cannot play when queue is empty
This commit is contained in:
parent
887026a58d
commit
993cb6d281
@ -205,7 +205,11 @@ func (c Command) defineCommands() {
|
||||
}
|
||||
|
||||
gomu.queue.pushFront(a)
|
||||
gomu.player.Skip()
|
||||
if gomu.player.IsRunning() {
|
||||
gomu.player.Skip()
|
||||
} else {
|
||||
gomu.queue.playQueue()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
4
start.go
4
start.go
@ -241,9 +241,11 @@ module General {
|
||||
invidious_instance = "https://vid.puffyan.us"
|
||||
# Prefered language for lyrics to be displayed, if not available, english version
|
||||
# will be displayed.
|
||||
# Available tags: en,el,ko,es,th,vi,zh-Hans,zh-Hant, and can be separated with comma.
|
||||
# Available tags: en,el,ko,es,th,vi,zh-Hans,zh-Hant,zh-CN and can be separated with comma.
|
||||
# find more tags: youtube-dl --skip-download --list-subs "url"
|
||||
lang_lyric = "en"
|
||||
# When save tag, could rename the file by tag info: artist-songname-album
|
||||
rename_bytag = false
|
||||
}
|
||||
|
||||
module Emoji {
|
||||
|
50
tageditor.go
50
tageditor.go
@ -64,6 +64,14 @@ func tagPopup(node *AudioFile) (err error) {
|
||||
SetText(tag.Album()).
|
||||
SetFieldBackgroundColor(gomu.colors.popup)
|
||||
|
||||
leftBox := tview.NewBox().
|
||||
SetBorder(true).
|
||||
SetTitle(node.name).
|
||||
SetBackgroundColor(gomu.colors.popup).
|
||||
SetBorderColor(gomu.colors.accent).
|
||||
SetTitleColor(gomu.colors.accent).
|
||||
SetBorderPadding(1, 1, 2, 2)
|
||||
|
||||
getTagButton.SetSelectedFunc(func() {
|
||||
var titles []string
|
||||
audioFile := node
|
||||
@ -111,6 +119,16 @@ func tagPopup(node *AudioFile) (err error) {
|
||||
errorPopup(err)
|
||||
return
|
||||
}
|
||||
if gomu.anko.GetBool("General.rename_bytag") {
|
||||
newName := fmt.Sprintf("%s-%s", newTag.Artist, newTag.Title)
|
||||
err = gomu.playlist.rename(newName)
|
||||
if err != nil {
|
||||
errorPopup(err)
|
||||
return
|
||||
}
|
||||
gomu.playlist.refresh()
|
||||
leftBox.SetTitle(newName)
|
||||
}
|
||||
defaultTimedPopup(" Success ", "Tag update successfully")
|
||||
})
|
||||
}()
|
||||
@ -129,14 +147,28 @@ func tagPopup(node *AudioFile) (err error) {
|
||||
return
|
||||
}
|
||||
defer tag.Close()
|
||||
tag.SetArtist(artistInputField.GetText())
|
||||
tag.SetTitle(titleInputField.GetText())
|
||||
tag.SetAlbum(albumInputField.GetText())
|
||||
newArtist := artistInputField.GetText()
|
||||
newTitle := titleInputField.GetText()
|
||||
newAlbum := albumInputField.GetText()
|
||||
tag.SetArtist(newArtist)
|
||||
tag.SetTitle(newTitle)
|
||||
tag.SetAlbum(newAlbum)
|
||||
err = tag.Save()
|
||||
if err != nil {
|
||||
errorPopup(err)
|
||||
return
|
||||
}
|
||||
if gomu.anko.GetBool("General.rename_bytag") {
|
||||
newName := fmt.Sprintf("%s-%s", newArtist, newTitle)
|
||||
err = gomu.playlist.rename(newName)
|
||||
if err != nil {
|
||||
errorPopup(err)
|
||||
return
|
||||
}
|
||||
gomu.playlist.refresh()
|
||||
leftBox.SetTitle(newName)
|
||||
}
|
||||
|
||||
defaultTimedPopup(" Success ", "Tag update successfully")
|
||||
|
||||
}).
|
||||
@ -331,13 +363,7 @@ func tagPopup(node *AudioFile) (err error) {
|
||||
AddItem(rightFlex, 0, 3, true),
|
||||
nil,
|
||||
nil,
|
||||
tview.NewBox().
|
||||
SetBorder(true).
|
||||
SetTitle(node.name).
|
||||
SetBackgroundColor(gomu.colors.popup).
|
||||
SetBorderColor(gomu.colors.accent).
|
||||
SetTitleColor(gomu.colors.accent).
|
||||
SetBorderPadding(1, 1, 2, 2),
|
||||
leftBox,
|
||||
}
|
||||
|
||||
leftGrid.Box = lyricFlex.box
|
||||
@ -369,9 +395,9 @@ func tagPopup(node *AudioFile) (err error) {
|
||||
lyricFlex.cycleFocus(gomu.app, false)
|
||||
case tcell.KeyBacktab, tcell.KeyCtrlP, tcell.KeyCtrlK:
|
||||
lyricFlex.cycleFocus(gomu.app, true)
|
||||
case tcell.KeyRight:
|
||||
case tcell.KeyDown:
|
||||
lyricFlex.cycleFocus(gomu.app, false)
|
||||
case tcell.KeyLeft:
|
||||
case tcell.KeyUp:
|
||||
lyricFlex.cycleFocus(gomu.app, true)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user