diff --git a/service.go b/service.go index 9272a95..17a2e77 100644 --- a/service.go +++ b/service.go @@ -37,7 +37,7 @@ type Song interface { Title() string ID() string Filename() string - Duration() string + DurationString() string Thumbnail() string Playlist() Playlist DontSkip() bool diff --git a/service_soundcloud.go b/service_soundcloud.go index 2ed1570..54fa26f 100644 --- a/service_soundcloud.go +++ b/service_soundcloud.go @@ -13,7 +13,6 @@ import ( "os" "strconv" "strings" - "time" "github.com/jmoiron/jsonq" "github.com/layeh/gumble/gumble" @@ -115,7 +114,7 @@ func (sc SoundCloud) NewSong(user *gumble.User, trackData *jsonq.JsonQuery, offs url: url, thumbnail: thumbnail, submitter: user, - duration: durationMS / 1000, + Duration: durationMS / 1000, offset: offset, format: "mp3", playlist: playlist, diff --git a/service_youtube.go b/service_youtube.go index e354d9d..6447f05 100644 --- a/service_youtube.go +++ b/service_youtube.go @@ -91,7 +91,7 @@ func (yt YouTube) NewSong(user *gumble.User, id, offset string, playlist Playlis id: id, url: "https://youtu.be/" + id, offset: int(yt.parseTime(offset).Seconds()), - duration: int(yt.parseTime(duration).Seconds()), + Duration: int(yt.parseTime(duration).Seconds()), thumbnail: thumbnail, format: "m4a", skippers: make([]string, 0), @@ -132,11 +132,11 @@ func (yt YouTube) parseTime(duration string) time.Duration { seconds, _ = strconv.ParseInt(strings.TrimSuffix(timestampResult["seconds"], "S"), 10, 32) } - totalSeconds = int((days * 86400) + (hours * 3600) + (minutes * 60) + seconds) + totalSeconds = int64((days * 86400) + (hours * 3600) + (minutes * 60) + seconds) } else { totalSeconds = 0 } - return time.ParseDuration(totalSeconds + "s") + return time.ParseDuration(strconv.Itoa(totalSeconds) + "s") } // NewPlaylist gathers the metadata for a YouTube playlist and returns it. diff --git a/youtube_dl.go b/youtube_dl.go index b2ae282..c0b9b89 100644 --- a/youtube_dl.go +++ b/youtube_dl.go @@ -15,9 +15,9 @@ import ( "net/http" "os" "os/exec" - "strconv" "time" + "github.com/jmoiron/jsonq" "github.com/layeh/gumble/gumble" "github.com/layeh/gumble/gumble_ffmpeg" )