Fixing offset for youtube videos

This commit is contained in:
MichaelOultram 2015-09-26 17:30:55 +01:00
parent a610147236
commit d2d75f093d

View file

@ -108,7 +108,7 @@ func (yt YouTube) parseTime(duration string) time.Duration {
var days, hours, minutes, seconds, totalSeconds int64 var days, hours, minutes, seconds, totalSeconds int64
if duration != "" { if duration != "" {
timestampExp := regexp.MustCompile(`P(?P<days>\d+D)?T(?P<hours>\d+H)?(?P<minutes>\d+M)?(?P<seconds>\d+S)?`) timestampExp := regexp.MustCompile(`P(?P<days>\d+D)?T(?P<hours>\d+H)?(?P<minutes>\d+M)?(?P<seconds>\d+S)?`)
timestampMatch := timestampExp.FindStringSubmatch(duration) timestampMatch := timestampExp.FindStringSubmatch(strings.ToUpper(duration))
timestampResult := make(map[string]string) timestampResult := make(map[string]string)
for i, name := range timestampExp.SubexpNames() { for i, name := range timestampExp.SubexpNames() {
if i < len(timestampMatch) { if i < len(timestampMatch) {