2014-12-09 06:45:22 +01:00
|
|
|
/*
|
|
|
|
* MumbleDJ
|
|
|
|
* By Matthieu Grieger
|
|
|
|
* main.go
|
|
|
|
* Copyright (c) 2014 Matthieu Grieger (MIT License)
|
|
|
|
*/
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2014-12-10 00:41:50 +01:00
|
|
|
"flag"
|
|
|
|
"fmt"
|
2014-12-09 06:45:22 +01:00
|
|
|
"github.com/layeh/gumble/gumble"
|
2014-12-10 00:41:50 +01:00
|
|
|
//"github.com/layeh/gumble/gumble_ffmpeg"
|
2014-12-09 06:45:22 +01:00
|
|
|
"github.com/layeh/gumble/gumbleutil"
|
|
|
|
)
|
|
|
|
|
|
|
|
// MumbleDJ type declaration
|
|
|
|
type MumbleDJ struct {
|
2014-12-10 00:41:50 +01:00
|
|
|
serverAddress string
|
|
|
|
serverPort int
|
|
|
|
username string
|
|
|
|
password string
|
2014-12-09 06:45:22 +01:00
|
|
|
}
|
2014-12-10 00:41:50 +01:00
|
|
|
|
|
|
|
func main() {
|
|
|
|
var address, port, username, password string
|
|
|
|
flag.StringVar(&address, "server", "localhost", "address for Mumble server")
|
|
|
|
flag.StringVar(&port, "port", "64738", "port for Mumble server")
|
|
|
|
flag.StringVar(&username, "username", "MumbleDJ", "username of MumbleDJ on server")
|
|
|
|
flag.StringVar(&password, "password", "", "password for Mumble server (if needed)")
|
|
|
|
flag.Parse()
|
|
|
|
|
|
|
|
// Just testing server connection, will implement this into MumbleDJ type later
|
|
|
|
listener := gumbleutil.Listener{
|
|
|
|
TextMessage: func(e *gumble.TextMessageEvent) {
|
|
|
|
fmt.Printf("Received text message: %s\n", e.Message)
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
config := gumble.Config{
|
|
|
|
Username: username,
|
|
|
|
Password: password,
|
|
|
|
Address: address + ":" + port,
|
|
|
|
Listener: listener,
|
|
|
|
}
|
|
|
|
|
|
|
|
// Currently crashes on connect. Displays the following message:
|
|
|
|
// panic: x509: certificate is valid for Murmur Autogenerated Certificate v2
|
|
|
|
// Will investigate later.
|
|
|
|
client := gumble.NewClient(&config)
|
|
|
|
if err := client.Connect(); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|