From 995e93d627acfc995668c9b186450cfd4e36da65 Mon Sep 17 00:00:00 2001 From: MichaelOultram Date: Sat, 26 Sep 2015 17:51:34 +0100 Subject: [PATCH] youtube offset --- service_youtube.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/service_youtube.go b/service_youtube.go index e2fc76c..cd61648 100644 --- a/service_youtube.go +++ b/service_youtube.go @@ -88,7 +88,7 @@ func (yt YouTube) NewSong(user *gumble.User, id, offset string, playlist Playlis title: title, id: id, url: "https://youtu.be/" + id, - offset: int(yt.parseTime(offset, `t\=(?P\d+D)?(?P\d+H)?(?P\d+M)?(?P\d+S)?`).Seconds()), + offset: int(yt.parseTime(offset, `\?T\=(?P\d+D)?(?P\d+H)?(?P\d+M)?(?P\d+S)?`).Seconds()), duration: int(yt.parseTime(duration, `P(?P\d+D)?T(?P\d+H)?(?P\d+M)?(?P\d+S)?`).Seconds()), thumbnail: thumbnail, format: "m4a", @@ -105,7 +105,7 @@ func (yt YouTube) NewSong(user *gumble.User, id, offset string, playlist Playlis // parseTime converts from the string youtube returns to a time.Duration func (yt YouTube) parseTime(duration, regex string) time.Duration { - fmt.Printf("parseTime(%s)", duration) + fmt.Printf("parseTime(%s)", strings.ToUpper(duration)) var days, hours, minutes, seconds, totalSeconds int64 if duration != "" { timestampExp := regexp.MustCompile(regex)