Commit 3db88ef

bryfry <bryon.fryer@gmail.com>
2016-04-24 21:28:58
fix vtt file name and math error on videos > 1 hour
1 parent 19637d0
Changed files (1)
fcpxml2vtt.go
@@ -109,7 +109,8 @@ func vttTimeFmt(seconds float64) string {
 	t := time.Duration(seconds*1000) * time.Millisecond
 	h := math.Floor(t.Hours())
 	m := math.Floor((t - time.Duration(h)*time.Hour).Minutes())
-	s := (t - time.Duration(m)*time.Minute).Seconds()
+	s := (t - time.Duration(m)*time.Minute - time.Duration(h)*time.Hour).Seconds()
+	fmt.Printf("%02.f:%02.f:%06.3f", h, m, s)
 	return fmt.Sprintf("%02.f:%02.f:%06.3f", h, m, s)
 }
 
@@ -145,7 +146,7 @@ func main() {
 	for _, filename := range files {
 
 		chaptername := strings.TrimSuffix(filename, ".fcpxml")
-		vttDest := path.Join("..", "prod", chaptername, chaptername+".vtt")
+		vttDest := path.Join("..", "prod", chaptername, chaptername+"_chapters.vtt")
 		//vttDest := path.Join(chaptername + ".vtt")
 
 		fmt.Println("Parsing: " + filename)