From 79305a408df6c0eda4f5eedbb9ad94f83f50784b Mon Sep 17 00:00:00 2001 From: MichaelOultram Date: Sun, 16 Aug 2015 02:10:17 +0100 Subject: [PATCH] Soundcloud links with a time will be offset --- service_soundcloud.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/service_soundcloud.go b/service_soundcloud.go index 476e15c..cf5a76b 100644 --- a/service_soundcloud.go +++ b/service_soundcloud.go @@ -51,7 +51,7 @@ func (sc SoundCloud) NewRequest(user *gumble.User, url string) (string, error) { // Add all tracks for _, t := range tracks { - sc.NewSong(user, jsonq.NewQuery(t), playlist) + sc.NewSong(user, jsonq.NewQuery(t), 0, playlist) } if err == nil { return playlist.Title(), nil @@ -66,8 +66,8 @@ func (sc SoundCloud) NewRequest(user *gumble.User, url string) (string, error) { // Calculating offset offset := 0 timesplit := strings.Split(url, "#t=") - if timesplit.size == 2 { - offset = time.Duration(timesplit[1]).Seconds() + if timesplit.Length == 2 { + offset = time.ParseDuration(timesplit[1]).Seconds() } return sc.NewSong(user, apiResponse, offset, nil) @@ -89,7 +89,7 @@ func (sc SoundCloud) NewSong(user *gumble.User, trackData *jsonq.JsonQuery, offs // Check song is not longer than the MaxSongDuration if dj.conf.General.MaxSongDuration == 0 || (durationMS/1000) <= dj.conf.General.MaxSongDuration { - duration, err = time.ParseDuration(strconv.Itoa(durationMS) + "ms") + duration, _ := time.ParseDuration(strconv.Itoa(durationMS) + "ms") duration = strings.NewReplacer("h", ":", "m", ":", "s", ":").Replace(duration.String()) song := &YouTubeSong{