Updated soundcloud duration formatting

This commit is contained in:
MichaelOultram 2015-08-20 22:28:44 +01:00
parent 55e2b7168f
commit 41f12e9feb
2 changed files with 2 additions and 11 deletions

View file

@ -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

View file

@ -68,7 +68,6 @@ func (sc SoundCloud) NewRequest(user *gumble.User, url string) (string, error) {
offset += time * multiplier offset += time * multiplier
multiplier *= 60 multiplier *= 60
} }
fmt.Printf("Offset: " + strconv.Itoa(offset)) // DEBUG
} }
return sc.NewSong(user, apiResponse, offset, nil) 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 // Check song is not longer than the MaxSongDuration
if dj.conf.General.MaxSongDuration == 0 || (durationMS/1000) <= dj.conf.General.MaxSongDuration { if dj.conf.General.MaxSongDuration == 0 || (durationMS/1000) <= dj.conf.General.MaxSongDuration {
timeDuration, _ := time.ParseDuration(strconv.Itoa(durationMS) + "ms") timeDuration, _ := time.ParseDuration(strconv.Itoa(durationMS/1000) + "s")
duration := timeDuration.String() duration := strings.NewReplacer("h", ":", "m", ":", "s", "").Replace(timeDuration.String())
song := &YouTubeSong{ song := &YouTubeSong{
id: strconv.Itoa(id), id: strconv.Itoa(id),