From 90671fd1a504a736a7de8cb576863c98f53da088 Mon Sep 17 00:00:00 2001 From: MichaelOultram Date: Wed, 29 Jul 2015 02:04:32 +0100 Subject: [PATCH] Fixing build issues --- Makefile | 1 + commands.go | 4 +++- index.html | 18 ++++++++++++++++++ main.go | 6 +++--- web.go | 2 +- 5 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 index.html diff --git a/Makefile b/Makefile index 5de2412..36b484b 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,7 @@ clean: install: mkdir -p ~/.mumbledj/config 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; 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; diff --git a/commands.go b/commands.go index 99db8fd..59d66ea 100644 --- a/commands.go +++ b/commands.go @@ -166,9 +166,10 @@ func parseCommand(user *gumble.User, username, command string) { // add performs !add functionality. Checks input URL for service, and adds // 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 == "" { dj.SendPrivateMessage(user, NO_ARGUMENT_MSG) + return errors.New("NO_ARGUMENT") } else { title, err := findServiceAndAdd(user, url) if err == nil { @@ -176,6 +177,7 @@ func add(user *gumble.User, url string) { } else { dj.SendPrivateMessage(user, err.Error()) } + return err } } diff --git a/index.html b/index.html new file mode 100644 index 0000000..e4c1635 --- /dev/null +++ b/index.html @@ -0,0 +1,18 @@ + + + + + %s - mumbledj + + + +

Add Song Form

+ + + + \ No newline at end of file diff --git a/main.go b/main.go index bc8d710..b841957 100644 --- a/main.go +++ b/main.go @@ -102,7 +102,7 @@ func (dj *mumbledj) OnTextMessage(e *gumble.TextMessageEvent) { func (dj *mumbledj) OnUserChange(e *gumble.UserChangeEvent) { if e.Type.Has(gumble.UserChangeDisconnected) { 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().RemoveSkip(e.User.Name) @@ -228,8 +228,8 @@ func main() { if err := dj.client.Connect(); err != nil { fmt.Printf("Could not connect to Mumble server at %s:%s.\n", address, port) os.Exit(1) - } - + } + Webserver() <-dj.keepAlive diff --git a/web.go b/web.go index a7b43e0..c26bcf6 100644 --- a/web.go +++ b/web.go @@ -38,7 +38,7 @@ func addSong(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Invalid Token") } else { var url = html.UnescapeString(r.FormValue("url")) - fmt.Fprintf(w, url) + add(uname, url) } }