Removed the verbose command
This commit is contained in:
parent
5fed70ca66
commit
29eec2d242
|
@ -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.
|
* `-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.
|
* `-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.
|
* `-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
|
## FEATURES
|
||||||
* Plays audio from both YouTube videos and YouTube playlists!
|
* Plays audio from both YouTube videos and YouTube playlists!
|
||||||
|
|
13
main.go
13
main.go
|
@ -37,7 +37,6 @@ type mumbledj struct {
|
||||||
homeDir string
|
homeDir string
|
||||||
playlistSkips map[string][]string
|
playlistSkips map[string][]string
|
||||||
cache *SongCache
|
cache *SongCache
|
||||||
verbose bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnConnect event. First moves MumbleDJ into the default channel specified
|
// 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
|
// isNil checks to see if an object is nil
|
||||||
func isNil(a interface{}) bool {
|
func isNil(a interface{}) bool {
|
||||||
defer func() { recover() }()
|
defer func() { recover() }()
|
||||||
|
@ -203,7 +195,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var address, port, username, password, channel, pemCert, pemKey, accesstokens string
|
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(&address, "server", "localhost", "address for Mumble server")
|
||||||
flag.StringVar(&port, "port", "64738", "port 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(&pemKey, "key", "", "path to user PEM key for MumbleDJ")
|
||||||
flag.StringVar(&accesstokens, "accesstokens", "", "list of access tokens for channel auth")
|
flag.StringVar(&accesstokens, "accesstokens", "", "list of access tokens for channel auth")
|
||||||
flag.BoolVar(&insecure, "insecure", false, "skip certificate checking")
|
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.BoolVar(&testcode, "test", false, "[debug] tests the features of mumbledj")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
@ -242,7 +233,6 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
dj.defaultChannel = strings.Split(channel, "/")
|
dj.defaultChannel = strings.Split(channel, "/")
|
||||||
dj.verbose = verbose
|
|
||||||
|
|
||||||
dj.client.Attach(gumbleutil.Listener{
|
dj.client.Attach(gumbleutil.Listener{
|
||||||
Connect: dj.OnConnect,
|
Connect: dj.OnConnect,
|
||||||
|
@ -258,7 +248,6 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if testcode {
|
if testcode {
|
||||||
Verbose("Testing is enabled")
|
|
||||||
Test(password, address, port, strings.Split(accesstokens, " "))
|
Test(password, address, port, strings.Split(accesstokens, " "))
|
||||||
}
|
}
|
||||||
<-dj.keepAlive
|
<-dj.keepAlive
|
||||||
|
|
|
@ -64,8 +64,7 @@ func FindServiceAndAdd(user *gumble.User, url string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if urlService == nil {
|
if urlService == nil {
|
||||||
Verbose("INVALID_URL")
|
return errors.New(INVALID_URL_MSG)
|
||||||
return errors.New("INVALID_URL")
|
|
||||||
} else {
|
} else {
|
||||||
oldLength := dj.queue.Len()
|
oldLength := dj.queue.Len()
|
||||||
var title string
|
var title string
|
||||||
|
|
|
@ -39,9 +39,6 @@ func (sc SoundCloud) NewRequest(user *gumble.User, url string) (string, error) {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
// PLAYLIST
|
// PLAYLIST
|
||||||
if dj.HasPermission(user.Name, dj.conf.Permissions.AdminAddPlaylists) {
|
if dj.HasPermission(user.Name, dj.conf.Permissions.AdminAddPlaylists) {
|
||||||
// Check duration of playlist
|
|
||||||
//duration, _ := apiResponse.Int("duration")
|
|
||||||
|
|
||||||
// Create playlist
|
// Create playlist
|
||||||
title, _ := apiResponse.String("title")
|
title, _ := apiResponse.String("title")
|
||||||
permalink, _ := apiResponse.String("permalink_url")
|
permalink, _ := apiResponse.String("permalink_url")
|
||||||
|
@ -57,7 +54,6 @@ func (sc SoundCloud) NewRequest(user *gumble.User, url string) (string, error) {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return playlist.Title(), nil
|
return playlist.Title(), nil
|
||||||
} else {
|
} else {
|
||||||
Verbose("soundcloud.NewRequest: " + err.Error())
|
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -69,7 +69,6 @@ func (yt YouTube) NewRequest(user *gumble.User, url string) (string, error) {
|
||||||
if !isNil(song) {
|
if !isNil(song) {
|
||||||
return song.Title(), nil
|
return song.Title(), nil
|
||||||
} else {
|
} else {
|
||||||
Verbose("youtube.NewRequest: " + err.Error())
|
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,7 +166,6 @@ func (yt YouTube) NewSong(user *gumble.User, id, offset string, playlist Playlis
|
||||||
dontSkip: false,
|
dontSkip: false,
|
||||||
}
|
}
|
||||||
dj.queue.AddSong(song)
|
dj.queue.AddSong(song)
|
||||||
Verbose(song.Submitter() + " added track " + song.Title())
|
|
||||||
|
|
||||||
return song, nil
|
return song, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,9 +54,7 @@ func (dl *YouTubeSong) Download() error {
|
||||||
for s := range cmd.Args {
|
for s := range cmd.Args {
|
||||||
args += cmd.Args[s] + " "
|
args += cmd.Args[s] + " "
|
||||||
}
|
}
|
||||||
Verbose(args)
|
fmt.Printf(args + "\n" + string(output) + "\n" + "youtube-dl: " + err.Error() + "\n")
|
||||||
Verbose(string(output))
|
|
||||||
Verbose("youtube-dl: " + err.Error())
|
|
||||||
return errors.New("Song download failed.")
|
return errors.New("Song download failed.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,7 +78,6 @@ func (dl *YouTubeSong) Play() {
|
||||||
message = fmt.Sprintf(message+`<tr><td align="center">From playlist "%s"</td></tr>`, dl.playlist.Title())
|
message = fmt.Sprintf(message+`<tr><td align="center">From playlist "%s"</td></tr>`, dl.playlist.Title())
|
||||||
}
|
}
|
||||||
dj.client.Self.Channel.Send(message+`</table>`, false)
|
dj.client.Self.Channel.Send(message+`</table>`, false)
|
||||||
Verbose("Now playing " + dl.title)
|
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
dj.audioStream.Wait()
|
dj.audioStream.Wait()
|
||||||
|
|
Reference in a new issue