From 29eec2d242d140c0f4ff28e647fbae0ba0961cc8 Mon Sep 17 00:00:00 2001 From: MichaelOultram Date: Sun, 16 Aug 2015 01:10:35 +0100 Subject: [PATCH] Removed the verbose command --- README.md | 1 - main.go | 13 +------------ service.go | 3 +-- service_soundcloud.go | 4 ---- service_youtube.go | 2 -- youtube_dl.go | 5 +---- 6 files changed, 3 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 5bc7ea8..3cd40cd 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,6 @@ All commandline parameters are optional. Below are descriptions of all the avail * `-key`: Path to user PEM key. Defaults to no key. * `-insecure`: If included, the bot will not check the certs for the server. Try using this commandline flag if you are having connection issues. * `-accesstokens`: List of access tokens for the bot separated by spaces. Defaults to no access tokens. -* `-verbose`: Prints out song status into the console. ## FEATURES * Plays audio from both YouTube videos and YouTube playlists! diff --git a/main.go b/main.go index 1bd6df7..0de2dc4 100644 --- a/main.go +++ b/main.go @@ -37,7 +37,6 @@ type mumbledj struct { homeDir string playlistSkips map[string][]string cache *SongCache - verbose bool } // OnConnect event. First moves MumbleDJ into the default channel specified @@ -165,13 +164,6 @@ func CheckAPIKeys() { } } -// Verbose prints out messages only if verbose flag is true -func Verbose(msg string) { - if dj.verbose { - fmt.Printf(msg + "\n") - } -} - // isNil checks to see if an object is nil func isNil(a interface{}) bool { defer func() { recover() }() @@ -203,7 +195,7 @@ func main() { } var address, port, username, password, channel, pemCert, pemKey, accesstokens string - var insecure, verbose, testcode bool + var insecure, testcode bool flag.StringVar(&address, "server", "localhost", "address for Mumble server") flag.StringVar(&port, "port", "64738", "port for Mumble server") @@ -214,7 +206,6 @@ func main() { flag.StringVar(&pemKey, "key", "", "path to user PEM key for MumbleDJ") flag.StringVar(&accesstokens, "accesstokens", "", "list of access tokens for channel auth") flag.BoolVar(&insecure, "insecure", false, "skip certificate checking") - flag.BoolVar(&verbose, "verbose", false, "[debug] prints out debug messages to the console") flag.BoolVar(&testcode, "test", false, "[debug] tests the features of mumbledj") flag.Parse() @@ -242,7 +233,6 @@ func main() { } dj.defaultChannel = strings.Split(channel, "/") - dj.verbose = verbose dj.client.Attach(gumbleutil.Listener{ Connect: dj.OnConnect, @@ -258,7 +248,6 @@ func main() { } if testcode { - Verbose("Testing is enabled") Test(password, address, port, strings.Split(accesstokens, " ")) } <-dj.keepAlive diff --git a/service.go b/service.go index 624314f..c6ec6e1 100644 --- a/service.go +++ b/service.go @@ -64,8 +64,7 @@ func FindServiceAndAdd(user *gumble.User, url string) error { } if urlService == nil { - Verbose("INVALID_URL") - return errors.New("INVALID_URL") + return errors.New(INVALID_URL_MSG) } else { oldLength := dj.queue.Len() var title string diff --git a/service_soundcloud.go b/service_soundcloud.go index a1c2b2a..a204010 100644 --- a/service_soundcloud.go +++ b/service_soundcloud.go @@ -39,9 +39,6 @@ func (sc SoundCloud) NewRequest(user *gumble.User, url string) (string, error) { if err == nil { // PLAYLIST if dj.HasPermission(user.Name, dj.conf.Permissions.AdminAddPlaylists) { - // Check duration of playlist - //duration, _ := apiResponse.Int("duration") - // Create playlist title, _ := apiResponse.String("title") permalink, _ := apiResponse.String("permalink_url") @@ -57,7 +54,6 @@ func (sc SoundCloud) NewRequest(user *gumble.User, url string) (string, error) { if err == nil { return playlist.Title(), nil } else { - Verbose("soundcloud.NewRequest: " + err.Error()) return "", err } } else { diff --git a/service_youtube.go b/service_youtube.go index 6457e20..cc5a536 100644 --- a/service_youtube.go +++ b/service_youtube.go @@ -69,7 +69,6 @@ func (yt YouTube) NewRequest(user *gumble.User, url string) (string, error) { if !isNil(song) { return song.Title(), nil } else { - Verbose("youtube.NewRequest: " + err.Error()) return "", err } } @@ -167,7 +166,6 @@ func (yt YouTube) NewSong(user *gumble.User, id, offset string, playlist Playlis dontSkip: false, } dj.queue.AddSong(song) - Verbose(song.Submitter() + " added track " + song.Title()) return song, nil } diff --git a/youtube_dl.go b/youtube_dl.go index 0721506..64afb97 100644 --- a/youtube_dl.go +++ b/youtube_dl.go @@ -54,9 +54,7 @@ func (dl *YouTubeSong) Download() error { for s := range cmd.Args { args += cmd.Args[s] + " " } - Verbose(args) - Verbose(string(output)) - Verbose("youtube-dl: " + err.Error()) + fmt.Printf(args + "\n" + string(output) + "\n" + "youtube-dl: " + err.Error() + "\n") return errors.New("Song download failed.") } } @@ -80,7 +78,6 @@ func (dl *YouTubeSong) Play() { message = fmt.Sprintf(message+`From playlist "%s"`, dl.playlist.Title()) } dj.client.Self.Channel.Send(message+``, false) - Verbose("Now playing " + dl.title) go func() { dj.audioStream.Wait()