Fixing build errors

This commit is contained in:
MichaelOultram 2015-09-26 15:01:09 +01:00
parent b49dd88228
commit 1a8c1ce4d0
2 changed files with 6 additions and 5 deletions

View file

@ -74,7 +74,7 @@ func FindServiceAndAdd(user *gumble.User, url string) error {
} else { } else {
var title string var title string
var songsAdded = 0 var songsAdded = 0
var err error var songArray []Song
// 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 {
@ -123,6 +123,7 @@ func FindServiceAndAdd(user *gumble.User, url string) error {
return errors.New(AUDIO_FAIL_MSG) return errors.New(AUDIO_FAIL_MSG)
} }
} }
return nil
} }
} }

View file

@ -36,7 +36,7 @@ func (sc SoundCloud) ServiceName() string {
} }
// TrackName is the human readable version of the service name // TrackName is the human readable version of the service name
func (sc SoundCloud) TrackName() { func (sc SoundCloud) TrackName() string {
return "Song" return "Song"
} }
@ -53,7 +53,7 @@ func (sc SoundCloud) NewRequest(user *gumble.User, url string) ([]Song, error) {
timesplit := strings.Split(url, "#t=") timesplit := strings.Split(url, "#t=")
url = fmt.Sprintf("http://api.soundcloud.com/resolve?url=%s&client_id=%s", timesplit[0], os.Getenv("SOUNDCLOUD_API_KEY")) url = fmt.Sprintf("http://api.soundcloud.com/resolve?url=%s&client_id=%s", timesplit[0], os.Getenv("SOUNDCLOUD_API_KEY"))
if apiResponse, err = PerformGetRequest(url); err != nil { if apiResponse, err = PerformGetRequest(url); err != nil {
return "", errors.New(INVALID_API_KEY) return nil, errors.New(INVALID_API_KEY)
} }
tracks, err := apiResponse.ArrayOfObjects("tracks") tracks, err := apiResponse.ArrayOfObjects("tracks")
@ -69,7 +69,7 @@ func (sc SoundCloud) NewRequest(user *gumble.User, url string) ([]Song, error) {
// Add all tracks // Add all tracks
for _, t := range tracks { for _, t := range tracks {
if song, err = sc.NewSong(user, jsonq.NewQuery(t), 0, playlist); err == nil { if song, err := sc.NewSong(user, jsonq.NewQuery(t), 0, playlist); err == nil {
songArray = append(songArray, song) songArray = append(songArray, song)
} }
} }
@ -89,7 +89,7 @@ func (sc SoundCloud) NewRequest(user *gumble.User, url string) ([]Song, error) {
} }
// Add the track // Add the track
if song, err = sc.NewSong(user, apiResponse, offset, nil); err != nil { if song, err := sc.NewSong(user, apiResponse, offset, nil); err != nil {
return nil, err return nil, err
} }
return append(songArray, song), err return append(songArray, song), err