diff --git a/player.go b/player.go index d92baf8..ee7bf03 100644 --- a/player.go +++ b/player.go @@ -11,7 +11,6 @@ import ( "github.com/faiface/beep/effects" "github.com/faiface/beep/mp3" "github.com/faiface/beep/speaker" - "github.com/spf13/viper" ) type Song struct { @@ -81,9 +80,8 @@ func (p *Player) Run() { popupMessage := fmt.Sprintf("%s\n\n[ %s ]", song.name, fmtDuration(p.length)) - timeout := viper.GetInt("popup_timeout") - timedPopup(" Current Song ", popupMessage, time.Second*time.Duration(timeout)) + timedPopup(" Current Song ", popupMessage, popupTimeout) done := make(chan bool, 1) diff --git a/playlist.go b/playlist.go index 592a7be..fa52e8c 100644 --- a/playlist.go +++ b/playlist.go @@ -118,11 +118,11 @@ func InitPlaylist() *Playlist { if err != nil { timedPopup( " Error ", - "Unable to delete dir "+selectedDir.Name, time.Second*5) + "Unable to delete dir "+selectedDir.Name, popupTimeout) } else { timedPopup( " Success ", - selectedDir.Name+"\nhas been deleted successfully", time.Second*5) + selectedDir.Name+"\nhas been deleted successfully", popupTimeout) playlist.Refresh() } @@ -152,11 +152,11 @@ func InitPlaylist() *Playlist { if err != nil { timedPopup( - " Error ", "Unable to delete "+audioFile.Name, time.Second*5) + " Error ", "Unable to delete "+audioFile.Name, popupTimeout) } else { timedPopup( " Success ", - audioFile.Name+"\nhas been deleted successfully", time.Second*5) + audioFile.Name+"\nhas been deleted successfully", popupTimeout) playlist.Refresh() } @@ -476,7 +476,7 @@ func Ytdl(url string, selPlaylist *tview.TreeNode) { selAudioFile := selPlaylist.GetReference().(*AudioFile) selPlaylistName := selAudioFile.Name - timedPopup(" Ytdl ", "Downloading", time.Second*5) + timedPopup(" Ytdl ", "Downloading", popupTimeout) // specify the output path for ytdl outputDir := fmt.Sprintf( @@ -502,7 +502,7 @@ func Ytdl(url string, selPlaylist *tview.TreeNode) { err := cmd.Run() if err != nil { - timedPopup(" Error ", "Error running youtube-dl", time.Second*5) + timedPopup(" Error ", "Error running youtube-dl", popupTimeout) return } @@ -523,7 +523,7 @@ func Ytdl(url string, selPlaylist *tview.TreeNode) { timedPopup( " Ytdl ", downloadFinishedMessage, - time.Second*5, + popupTimeout, ) app.Draw() diff --git a/popup.go b/popup.go index ecf0c6b..b52dfd6 100644 --- a/popup.go +++ b/popup.go @@ -93,7 +93,7 @@ func volumePopup(volume float64) { "50", ) - timedPopup(" Volume ", progress, time.Second*5) + timedPopup(" Volume ", progress, popupTimeout) } @@ -114,6 +114,7 @@ func helpPopup() { "- volume down", "? toggle help", "Y download audio", + "a add playlist", } list := tview.NewList().ShowSecondaryText(false)