diff --git a/main.go b/main.go index 91c00bb..8a9d12a 100644 --- a/main.go +++ b/main.go @@ -14,6 +14,7 @@ import ( "os" "os/user" "reflect" + "regexp" "strings" "time" diff --git a/service.go b/service.go index 36c77ab..13a1d08 100644 --- a/service.go +++ b/service.go @@ -9,6 +9,7 @@ package main import ( "errors" + "fmt" "github.com/layeh/gumble/gumble" ) @@ -64,7 +65,7 @@ func findServiceAndAdd(user *gumble.User, url string) error { } if urlService == nil { - return "", errors.New("INVALID_URL") + return errors.New("INVALID_URL") } else { oldLength := dj.queue.Len() var title string @@ -80,7 +81,7 @@ func findServiceAndAdd(user *gumble.User, url string) error { } else { dj.queue.CurrentSong().Delete() dj.queue.OnSongFinished() - return "", errors.New("FAILED_TO_DOWNLOAD") + return errors.New("FAILED_TO_DOWNLOAD") } } } else { diff --git a/web.go b/web.go index 25ce20f..398cc02 100644 --- a/web.go +++ b/web.go @@ -36,7 +36,7 @@ func Webserver(port int) *WebServer { return &webserver } -func (w WebServer) homepage(w http.ResponseWriter, r *http.Request) { +func (web WebServer) homepage(w http.ResponseWriter, r *http.Request) { var uname = token_client[r.URL.Path[1:]] if uname == nil { fmt.Fprintf(w, "Invalid Token") @@ -46,7 +46,7 @@ func (w WebServer) homepage(w http.ResponseWriter, r *http.Request) { } } -func (w WebServer) add(w http.ResponseWriter, r *http.Request) { +func (web WebServer) add(w http.ResponseWriter, r *http.Request) { var uname = token_client[r.FormValue("token")] if uname == nil { fmt.Fprintf(w, "Invalid Token") @@ -55,7 +55,7 @@ func (w WebServer) add(w http.ResponseWriter, r *http.Request) { } } -func (w WebServer) volume(w http.ResponseWriter, r *http.Request) { +func (web WebServer) volume(w http.ResponseWriter, r *http.Request) { var uname = token_client[r.FormValue("token")] if uname == nil { fmt.Fprintf(w, "Invalid Token") @@ -65,7 +65,7 @@ func (w WebServer) volume(w http.ResponseWriter, r *http.Request) { } } -func (w WebServer) skip(w http.ResponseWriter, r *http.Request) { +func (web WebServer) skip(w http.ResponseWriter, r *http.Request) { var uname = token_client[r.FormValue("token")] if uname == nil { fmt.Fprintf(w, "Invalid Token") @@ -75,7 +75,7 @@ func (w WebServer) skip(w http.ResponseWriter, r *http.Request) { } } -func (w WebServer) GetWebAddress(user *gumble.User) { +func (web WebServer) GetWebAddress(user *gumble.User) { if client_token[user] != "" { token_client[client_token[user]] = nil }