From 3ebb51fbcdd7d63ddbd85694ac0a6e17a96cdde0 Mon Sep 17 00:00:00 2001 From: HowIChrgeLazer Date: Sat, 19 Dec 2015 21:21:11 -0800 Subject: [PATCH 1/2] Added AnnounceNewTrack config bool Added a new boolean named AnnounceNewTrack that has the ability to disable the song information upon playing the track. --- config.gcfg | 4 ++++ parseconfig.go | 1 + youtube_dl.go | 5 +++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/config.gcfg b/config.gcfg index 8cbb259..78d2223 100644 --- a/config.gcfg +++ b/config.gcfg @@ -34,6 +34,10 @@ MaxSongPerPlaylist = 50 # Default Value: false AutomaticShuffleOn = false +# Announce song information at start of track +# Default Value: true +AnnounceNewTrack = true + [Cache] # Cache songs as they are downloaded? diff --git a/parseconfig.go b/parseconfig.go index 7dbfddd..ae933ea 100644 --- a/parseconfig.go +++ b/parseconfig.go @@ -24,6 +24,7 @@ type DjConfig struct { MaxSongDuration int MaxSongPerPlaylist int AutomaticShuffleOn bool + AnnounceNewTrack bool } Cache struct { Enabled bool diff --git a/youtube_dl.go b/youtube_dl.go index 20a2eea..af0af59 100644 --- a/youtube_dl.go +++ b/youtube_dl.go @@ -91,8 +91,9 @@ func (dl *AudioTrack) Play() { if !isNil(dl.playlist) { message = fmt.Sprintf(message+`From playlist "%s"`, dl.Playlist().Title()) } - dj.client.Self.Channel.Send(message+``, false) - + if dj.conf.General.AnnounceNewTrack == true { + dj.client.Self.Channel.Send(message+``, false) + } go func() { dj.audioStream.Wait() dj.queue.OnSongFinished() From d4ea58e6e9de16cde00a4a747d836cb6ae5597dc Mon Sep 17 00:00:00 2001 From: HowIChrgeLazer Date: Sat, 19 Dec 2015 21:36:47 -0800 Subject: [PATCH 2/2] Small line fix as requested --- youtube_dl.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl.go b/youtube_dl.go index af0af59..ff39510 100644 --- a/youtube_dl.go +++ b/youtube_dl.go @@ -91,7 +91,7 @@ func (dl *AudioTrack) Play() { if !isNil(dl.playlist) { message = fmt.Sprintf(message+`From playlist "%s"`, dl.Playlist().Title()) } - if dj.conf.General.AnnounceNewTrack == true { + if dj.conf.General.AnnounceNewTrack { dj.client.Self.Channel.Send(message+``, false) } go func() {