Fix https://github.com/matthieugrieger/mumbledj/issues/176: Empty IDs for SoundCloud tracks
This commit is contained in:
parent
9222608962
commit
51db9c3061
|
@ -1,6 +1,10 @@
|
||||||
MumbleDJ Changelog
|
MumbleDJ Changelog
|
||||||
==================
|
==================
|
||||||
|
|
||||||
|
### August 22, 2016 -- `v3.1.4`
|
||||||
|
* Fixed a SoundCloud API response parsing issue that would result in empty IDs for tracks.
|
||||||
|
* Fixed the startup check for SoundCloud API.
|
||||||
|
|
||||||
### August 21, 2016 -- `v3.1.3`
|
### August 21, 2016 -- `v3.1.3`
|
||||||
* Fixed a deadlock that would occur during the transition from the first to second track in a queue.
|
* Fixed a deadlock that would occur during the transition from the first to second track in a queue.
|
||||||
|
|
||||||
|
|
2
main.go
2
main.go
|
@ -32,7 +32,7 @@ func init() {
|
||||||
services.DJ = DJ
|
services.DJ = DJ
|
||||||
bot.DJ = DJ
|
bot.DJ = DJ
|
||||||
|
|
||||||
DJ.Version = "v3.1.3"
|
DJ.Version = "v3.1.4"
|
||||||
|
|
||||||
logrus.SetLevel(logrus.WarnLevel)
|
logrus.SetLevel(logrus.WarnLevel)
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ func (sc *SoundCloud) CheckAPIKey() error {
|
||||||
if viper.GetString("api_keys.soundcloud") == "" {
|
if viper.GetString("api_keys.soundcloud") == "" {
|
||||||
return errors.New("No SoundCloud API key has been provided")
|
return errors.New("No SoundCloud API key has been provided")
|
||||||
}
|
}
|
||||||
url := "http://api.soundcloud.com/tracks/vjflzpbkmerb?client_id=%s"
|
url := "http://api.soundcloud.com/tracks/13158665?client_id=%s"
|
||||||
response, err := http.Get(fmt.Sprintf(url, viper.GetString("api_keys.soundcloud")))
|
response, err := http.Get(fmt.Sprintf(url, viper.GetString("api_keys.soundcloud")))
|
||||||
defer response.Body.Close()
|
defer response.Body.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -162,7 +162,8 @@ func (sc *SoundCloud) GetTracks(url string, submitter *gumble.User) ([]interface
|
||||||
|
|
||||||
func (sc *SoundCloud) getTrack(obj *jason.Object, offset time.Duration, submitter *gumble.User) (bot.Track, error) {
|
func (sc *SoundCloud) getTrack(obj *jason.Object, offset time.Duration, submitter *gumble.User) (bot.Track, error) {
|
||||||
title, _ := obj.GetString("title")
|
title, _ := obj.GetString("title")
|
||||||
id, _ := obj.GetString("id")
|
idInt, _ := obj.GetInt64("id")
|
||||||
|
id := strconv.FormatInt(idInt, 10)
|
||||||
url, _ := obj.GetString("permalink_url")
|
url, _ := obj.GetString("permalink_url")
|
||||||
author, _ := obj.GetString("user", "username")
|
author, _ := obj.GetString("user", "username")
|
||||||
authorURL, _ := obj.GetString("user", "permalink_url")
|
authorURL, _ := obj.GetString("user", "permalink_url")
|
||||||
|
|
Reference in a new issue