Fixing build issues

This commit is contained in:
MichaelOultram 2015-07-29 02:04:32 +01:00
parent cccb76d553
commit 90671fd1a5
5 changed files with 26 additions and 5 deletions

View file

@ -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;

View file

@ -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
}
}

18
index.html Normal file
View 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>

View file

@ -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

2
web.go
View file

@ -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)
}
}