diff --git a/command.go b/command.go index 1b490bf..bba9741 100644 --- a/command.go +++ b/command.go @@ -10,7 +10,6 @@ import ( "github.com/ztrue/tracerr" ) - type Command struct { commands map[string]func() } diff --git a/player.go b/player.go index f1cdb50..f938183 100644 --- a/player.go +++ b/player.go @@ -308,3 +308,12 @@ func (p *Player) seek(pos int) error { p.i = pos - 1 return err } + +// isPaused is used to distinguish the player between pause and stop +func (p *Player) isPaused() bool { + if p.ctrl == nil { + return false + } + + return p.ctrl.Paused +} diff --git a/playlist.go b/playlist.go index b841814..42a77e0 100644 --- a/playlist.go +++ b/playlist.go @@ -356,7 +356,7 @@ func (p *Playlist) addSongToPlaylist( displayText := songName if viper.GetBool("general.emoji") { - displayText = fmt.Sprintf(" %s %s", + displayText = fmt.Sprintf(" %s %s", viper.GetString("emoji.file"), songName) } @@ -459,7 +459,6 @@ func (p *Playlist) findAudioFile(audioName string) (*AudioFile, error) { return selNode, nil } - func (p *Playlist) rename(newName string) error { currentNode := p.GetCurrentNode() @@ -524,7 +523,6 @@ Download: } - // Download audio from youtube audio and adds the song to the selected playlist func ytdl(url string, selPlaylist *tview.TreeNode) error { diff --git a/queue.go b/queue.go index 09b8955..ce53ba7 100644 --- a/queue.go +++ b/queue.go @@ -154,8 +154,9 @@ func (q *Queue) dequeue() (*AudioFile, error) { // Add item to the list and returns the length of the queue func (q *Queue) enqueue(audioFile *AudioFile) (int, error) { - //this is to fix the problem bulk_add when paused - if !gomu.player.isRunning && os.Getenv("TEST") == "false" { + player := gomu.player + + if !player.isRunning && !player.isPaused() && os.Getenv("TEST") == "false" { gomu.player.isRunning = true @@ -320,7 +321,6 @@ func (q *Queue) getSavedQueue() ([]string, error) { return records, nil } - func (q *Queue) help() []string { return []string{