Fixing build errors
This commit is contained in:
parent
2880d78db1
commit
b49dd88228
|
@ -11,7 +11,6 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/layeh/gumble/gumble"
|
"github.com/layeh/gumble/gumble"
|
||||||
|
@ -75,10 +74,10 @@ func FindServiceAndAdd(user *gumble.User, url string) error {
|
||||||
} else {
|
} else {
|
||||||
var title string
|
var title string
|
||||||
var songsAdded = 0
|
var songsAdded = 0
|
||||||
var err errors
|
var err error
|
||||||
|
|
||||||
// Get service to create songs
|
// Get service to create songs
|
||||||
if songArray, err = urlService.NewRequest(user, url); err != nil {
|
if songArray, err := urlService.NewRequest(user, url); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,6 +89,7 @@ func FindServiceAndAdd(user *gumble.User, url string) error {
|
||||||
// Loop through all songs and add to the queue
|
// Loop through all songs and add to the queue
|
||||||
oldLength := dj.queue.Len()
|
oldLength := dj.queue.Len()
|
||||||
for song := range songArray {
|
for song := range songArray {
|
||||||
|
// Check song is not too long
|
||||||
time, _ := time.ParseDuration(song.Duration())
|
time, _ := time.ParseDuration(song.Duration())
|
||||||
if dj.conf.General.MaxSongDuration == 0 || int(time.Seconds()) <= dj.conf.General.MaxSongDuration {
|
if dj.conf.General.MaxSongDuration == 0 || int(time.Seconds()) <= dj.conf.General.MaxSongDuration {
|
||||||
if !isNil(song.Playlist()) {
|
if !isNil(song.Playlist()) {
|
||||||
|
@ -98,11 +98,13 @@ func FindServiceAndAdd(user *gumble.User, url string) error {
|
||||||
title = song.Title()
|
title = song.Title()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add song to queue
|
||||||
dj.queue.AddSong(song)
|
dj.queue.AddSong(song)
|
||||||
songsAdded++
|
songsAdded++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Alert channel of added song/playlist
|
||||||
if songsAdded == 0 {
|
if songsAdded == 0 {
|
||||||
return errors.New(TRACK_TOO_LONG_MSG)
|
return errors.New(TRACK_TOO_LONG_MSG)
|
||||||
} else if songsAdded == 1 {
|
} else if songsAdded == 1 {
|
||||||
|
|
|
@ -8,11 +8,8 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
|
||||||
"os"
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
|
@ -8,8 +8,11 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"time"
|
"time"
|
||||||
|
|
Reference in a new issue