From 41f12e9feb25482a8361f2b4cbc6b53601be7b49 Mon Sep 17 00:00:00 2001 From: MichaelOultram Date: Thu, 20 Aug 2015 22:28:44 +0100 Subject: [PATCH] Updated soundcloud duration formatting --- Goopfile.lock | 8 -------- service_soundcloud.go | 5 ++--- 2 files changed, 2 insertions(+), 11 deletions(-) delete mode 100644 Goopfile.lock diff --git a/Goopfile.lock b/Goopfile.lock deleted file mode 100644 index 887e548..0000000 --- a/Goopfile.lock +++ /dev/null @@ -1,8 +0,0 @@ -code.google.com/p/gcfg #c2d3050044d0 -github.com/golang/protobuf #0f7a9caded1fb3c9cc5a9b4bcf2ff633cc8ae644 -github.com/jmoiron/jsonq #7c27c8eb9f6831555a4209f6a7d579159e766a3c -github.com/layeh/gopus #2f86fa22bc209cc0ccbc6418dfbad9199e3dbc78 -github.com/layeh/gumble/gumble #8b9989d9c4090874546c45ceaa6ff21e95705bc4 -github.com/layeh/gumble/gumble_ffmpeg #c9fcce8fc4b71c7c53a5d3d9d48a1e001ad19a19 -github.com/layeh/gumble/gumbleutil #abf58b0ea8b2661897f81cf69c2a6a3e37152d74 -github.com/timshannon/go-openal #f4fbb66b2922de93753ac8069ff62d20a56a7450 diff --git a/service_soundcloud.go b/service_soundcloud.go index 2b4714d..45ce9bb 100644 --- a/service_soundcloud.go +++ b/service_soundcloud.go @@ -68,7 +68,6 @@ func (sc SoundCloud) NewRequest(user *gumble.User, url string) (string, error) { offset += time * multiplier multiplier *= 60 } - fmt.Printf("Offset: " + strconv.Itoa(offset)) // DEBUG } return sc.NewSong(user, apiResponse, offset, nil) } @@ -89,8 +88,8 @@ 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 { - timeDuration, _ := time.ParseDuration(strconv.Itoa(durationMS) + "ms") - duration := timeDuration.String() + timeDuration, _ := time.ParseDuration(strconv.Itoa(durationMS/1000) + "s") + duration := strings.NewReplacer("h", ":", "m", ":", "s", "").Replace(timeDuration.String()) song := &YouTubeSong{ id: strconv.Itoa(id),