Fixing build errors

This commit is contained in:
MichaelOultram 2015-08-03 22:51:38 +01:00
parent a135b4fe4d
commit b36cb3de37
2 changed files with 24 additions and 6 deletions

12
web.go
View file

@ -128,13 +128,15 @@ func (web *WebServer) skip(w http.ResponseWriter, r *http.Request) {
func (web *WebServer) status(w http.ResponseWriter, r *http.Request) { func (web *WebServer) status(w http.ResponseWriter, r *http.Request) {
var uname = web.token_client[r.FormValue("token")] var uname = web.token_client[r.FormValue("token")]
if uname == nil { if uname == nil {
fmt.Fprintf(w, string(json.Marshal(&Status{true, "Invalid Token"}))) str, ok := json.Marshal(&Status{true, "Invalid Token"}).(string)
fmt.Fprintf(w, str)
} else { } else {
// Generate song queue // Generate song queue
var songsInQueue [dj.queue.Len()]SongInfo queueLength := dj.queue.Len()
var songsInQueue [queueLength]SongInfo
for i := 0; i < dj.queue.Len(); i++ { for i := 0; i < dj.queue.Len(); i++ {
songItem := dj.queue.Get(i) songItem := dj.queue.Get(i)
songs[i] = &SongInfo{ songsInQueue[i] = &SongInfo{
TitleID: songItem.ID(), TitleID: songItem.ID(),
Title: songItem.Title(), Title: songItem.Title(),
Submitter: songItem.Submitter(), Submitter: songItem.Submitter(),
@ -142,8 +144,8 @@ func (web *WebServer) status(w http.ResponseWriter, r *http.Request) {
Thumbnail: songItem.Thumbnail(), Thumbnail: songItem.Thumbnail(),
} }
if !isNil(songItem.Playlist()) { if !isNil(songItem.Playlist()) {
songs[i].PlaylistID = songItem.Playlist().ID() songsInQueuei].PlaylistID = songItem.Playlist().ID()
songs[i].Playlist = songItem.Playlist().Title() songsInQueue[i].Playlist = songItem.Playlist().Title()
} }
} }

View file

@ -1,6 +1,22 @@
package main package main
import () import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"os"
"os/exec"
"regexp"
"strconv"
"strings"
"time"
"github.com/jmoiron/jsonq"
"github.com/layeh/gumble/gumble"
"github.com/layeh/gumble/gumble_ffmpeg"
)
type YouTubeDL struct { type YouTubeDL struct {
id string id string