Fixing build issues
This commit is contained in:
parent
cccb76d553
commit
90671fd1a5
1
Makefile
1
Makefile
|
@ -12,6 +12,7 @@ clean:
|
||||||
install:
|
install:
|
||||||
mkdir -p ~/.mumbledj/config
|
mkdir -p ~/.mumbledj/config
|
||||||
mkdir -p ~/.mumbledj/songs
|
mkdir -p ~/.mumbledj/songs
|
||||||
|
mkdir -p ~/.mumbledj/web
|
||||||
if [ -a ~/.mumbledj/config/mumbledj.gcfg ]; then mv ~/.mumbledj/config/mumbledj.gcfg ~/.mumbledj/config/mumbledj_backup.gcfg; fi;
|
if [ -a ~/.mumbledj/config/mumbledj.gcfg ]; then mv ~/.mumbledj/config/mumbledj.gcfg ~/.mumbledj/config/mumbledj_backup.gcfg; fi;
|
||||||
cp -u config.gcfg ~/.mumbledj/config/mumbledj.gcfg
|
cp -u config.gcfg ~/.mumbledj/config/mumbledj.gcfg
|
||||||
if [ -d ~/bin ]; then cp -f mumbledj* ~/bin/mumbledj; else sudo cp -f mumbledj* /usr/local/bin/mumbledj; fi;
|
if [ -d ~/bin ]; then cp -f mumbledj* ~/bin/mumbledj; else sudo cp -f mumbledj* /usr/local/bin/mumbledj; fi;
|
||||||
|
|
|
@ -166,9 +166,10 @@ func parseCommand(user *gumble.User, username, command string) {
|
||||||
|
|
||||||
// add performs !add functionality. Checks input URL for service, and adds
|
// add performs !add functionality. Checks input URL for service, and adds
|
||||||
// the URL to the queue if the format matches.
|
// the URL to the queue if the format matches.
|
||||||
func add(user *gumble.User, url string) {
|
func add(user *gumble.User, url string) error {
|
||||||
if url == "" {
|
if url == "" {
|
||||||
dj.SendPrivateMessage(user, NO_ARGUMENT_MSG)
|
dj.SendPrivateMessage(user, NO_ARGUMENT_MSG)
|
||||||
|
return errors.New("NO_ARGUMENT")
|
||||||
} else {
|
} else {
|
||||||
title, err := findServiceAndAdd(user, url)
|
title, err := findServiceAndAdd(user, url)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
@ -176,6 +177,7 @@ func add(user *gumble.User, url string) {
|
||||||
} else {
|
} else {
|
||||||
dj.SendPrivateMessage(user, err.Error())
|
dj.SendPrivateMessage(user, err.Error())
|
||||||
}
|
}
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
18
index.html
Normal file
18
index.html
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="ISO-8859-1">
|
||||||
|
<title>%s - mumbledj</title>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function addURL(url) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Add Song Form</h1>
|
||||||
|
<input type="text"/>
|
||||||
|
<input type="button" value="Add Song" />
|
||||||
|
</body>
|
||||||
|
</html>
|
6
main.go
6
main.go
|
@ -102,7 +102,7 @@ func (dj *mumbledj) OnTextMessage(e *gumble.TextMessageEvent) {
|
||||||
func (dj *mumbledj) OnUserChange(e *gumble.UserChangeEvent) {
|
func (dj *mumbledj) OnUserChange(e *gumble.UserChangeEvent) {
|
||||||
if e.Type.Has(gumble.UserChangeDisconnected) {
|
if e.Type.Has(gumble.UserChangeDisconnected) {
|
||||||
if dj.audioStream.IsPlaying() {
|
if dj.audioStream.IsPlaying() {
|
||||||
if dj.queue.CurrentSong().Playlist() != nil {
|
if !isNull(dj.queue.CurrentSong().Playlist()) {
|
||||||
dj.queue.CurrentSong().Playlist().RemoveSkip(e.User.Name)
|
dj.queue.CurrentSong().Playlist().RemoveSkip(e.User.Name)
|
||||||
}
|
}
|
||||||
dj.queue.CurrentSong().RemoveSkip(e.User.Name)
|
dj.queue.CurrentSong().RemoveSkip(e.User.Name)
|
||||||
|
@ -228,8 +228,8 @@ func main() {
|
||||||
if err := dj.client.Connect(); err != nil {
|
if err := dj.client.Connect(); err != nil {
|
||||||
fmt.Printf("Could not connect to Mumble server at %s:%s.\n", address, port)
|
fmt.Printf("Could not connect to Mumble server at %s:%s.\n", address, port)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
Webserver()
|
Webserver()
|
||||||
|
|
||||||
<-dj.keepAlive
|
<-dj.keepAlive
|
||||||
|
|
2
web.go
2
web.go
|
@ -38,7 +38,7 @@ func addSong(w http.ResponseWriter, r *http.Request) {
|
||||||
fmt.Fprintf(w, "Invalid Token")
|
fmt.Fprintf(w, "Invalid Token")
|
||||||
} else {
|
} else {
|
||||||
var url = html.UnescapeString(r.FormValue("url"))
|
var url = html.UnescapeString(r.FormValue("url"))
|
||||||
fmt.Fprintf(w, url)
|
add(uname, url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue