Fixing build errors
This commit is contained in:
parent
974a52df7e
commit
5e70e69222
58
web.go
58
web.go
|
@ -59,7 +59,7 @@ func (web *WebServer) makeWeb() {
|
||||||
http.HandleFunc("/api/add", web.add)
|
http.HandleFunc("/api/add", web.add)
|
||||||
http.HandleFunc("/api/volume", web.volume)
|
http.HandleFunc("/api/volume", web.volume)
|
||||||
http.HandleFunc("/api/skip", web.skip)
|
http.HandleFunc("/api/skip", web.skip)
|
||||||
http.HandleFunc("/api/status", web.status)
|
//http.HandleFunc("/api/status", web.status)
|
||||||
http.ListenAndServe(":"+strconv.Itoa(web.port), nil)
|
http.ListenAndServe(":"+strconv.Itoa(web.port), nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,34 +125,34 @@ 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 {
|
||||||
str, ok := json.Marshal(&Status{true, "Invalid Token"}).(string)
|
// str, ok := json.Marshal(&Status{true, "Invalid Token"}).(string)
|
||||||
fmt.Fprintf(w, str)
|
// fmt.Fprintf(w, str)
|
||||||
} else {
|
// } else {
|
||||||
// Generate song queue
|
// // Generate song queue
|
||||||
queueLength := dj.queue.Len()
|
// queueLength := dj.queue.Len()
|
||||||
var songsInQueue [queueLength]SongInfo
|
// 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)
|
||||||
songsInQueue[i] = &SongInfo{
|
// songsInQueue[i] = &SongInfo{
|
||||||
TitleID: songItem.ID(),
|
// TitleID: songItem.ID(),
|
||||||
Title: songItem.Title(),
|
// Title: songItem.Title(),
|
||||||
Submitter: songItem.Submitter(),
|
// Submitter: songItem.Submitter(),
|
||||||
Duration: songItem.Duration(),
|
// Duration: songItem.Duration(),
|
||||||
Thumbnail: songItem.Thumbnail(),
|
// Thumbnail: songItem.Thumbnail(),
|
||||||
}
|
// }
|
||||||
if !isNil(songItem.Playlist()) {
|
// if !isNil(songItem.Playlist()) {
|
||||||
songsInQueue[i].PlaylistID = songItem.Playlist().ID()
|
// songsInQueue[i].PlaylistID = songItem.Playlist().ID()
|
||||||
songsInQueue[i].Playlist = songItem.Playlist().Title()
|
// songsInQueue[i].Playlist = songItem.Playlist().Title()
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// Output status
|
// // Output status
|
||||||
fmt.Fprintf(w, string(json.MarshalIndent(&Status{false, "", songsInQueue})))
|
// fmt.Fprintf(w, string(json.MarshalIndent(&Status{false, "", songsInQueue})))
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
func (website *WebServer) GetWebAddress(user *gumble.User) {
|
func (website *WebServer) GetWebAddress(user *gumble.User) {
|
||||||
Verbose("Port number: " + strconv.Itoa(web.port))
|
Verbose("Port number: " + strconv.Itoa(web.port))
|
||||||
|
|
|
@ -26,8 +26,8 @@ type YouTubeDL struct {
|
||||||
func (dl *YouTubeDL) Download() error {
|
func (dl *YouTubeDL) Download() error {
|
||||||
|
|
||||||
// Checks to see if song is already downloaded
|
// Checks to see if song is already downloaded
|
||||||
if _, err := os.Stat(fmt.Sprintf("%s/.mumbledj/songs/%s", dj.homeDir, id+".m4a")); os.IsNotExist(err) {
|
if _, err := os.Stat(fmt.Sprintf("%s/.mumbledj/songs/%s", dj.homeDir, dl.id+".m4a")); os.IsNotExist(err) {
|
||||||
cmd := exec.Command("youtube-dl", "--output", fmt.Sprintf(`~/.mumbledj/songs/%s`, id+".m4a"), "--format", "m4a", "--", url)
|
cmd := exec.Command("youtube-dl", "--output", fmt.Sprintf(`~/.mumbledj/songs/%s`, dl.id+".m4a"), "--format", "m4a", "--", dl.url)
|
||||||
if err := cmd.Run(); err == nil {
|
if err := cmd.Run(); err == nil {
|
||||||
if dj.conf.Cache.Enabled {
|
if dj.conf.Cache.Enabled {
|
||||||
dj.cache.CheckMaximumDirectorySize()
|
dj.cache.CheckMaximumDirectorySize()
|
||||||
|
@ -42,7 +42,7 @@ func (dl *YouTubeDL) Download() error {
|
||||||
// Play plays the song. Once the song is playing, a notification is displayed in a text message that features the song
|
// Play plays the song. Once the song is playing, a notification is displayed in a text message that features the song
|
||||||
// thumbnail, URL, title, duration, and submitter.
|
// thumbnail, URL, title, duration, and submitter.
|
||||||
func (dl *YouTubeDL) Play() {
|
func (dl *YouTubeDL) Play() {
|
||||||
if s.offset != 0 {
|
if dl.offset != 0 {
|
||||||
offsetDuration, _ := time.ParseDuration(fmt.Sprintf("%ds", dl.offset))
|
offsetDuration, _ := time.ParseDuration(fmt.Sprintf("%ds", dl.offset))
|
||||||
dj.audioStream.Offset = offsetDuration
|
dj.audioStream.Offset = offsetDuration
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue