summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go34
1 files changed, 13 insertions, 21 deletions
diff --git a/main.go b/main.go
index 302439c..a2eae60 100644
--- a/main.go
+++ b/main.go
@@ -78,6 +78,10 @@ func linesToUtterances(lines []string, fd *FileData) []*Utterance {
}
u.OutPath = fmt.Sprintf("%s/%s_%s_%s.wav", outdir, fd.AudioBase,
u.LeftTime, u.RightTime)
+
+ if u.LeftTime == u.RightTime {
+ continue
+ }
resp = append(resp, u)
}
@@ -235,27 +239,15 @@ func main() {
panic(err)
}
- ffmpegCommands := make(map[string]struct{})
- // // needs to be oneline command to be unique
- // ffCommandsRaw := readLines(ffCmdOut)
- // for _, ff := range ffCommandsRaw {
- // ffmpegCommands[ff] = struct{}{}
- // }
- for _, ut := range utterances {
- ffmpegCommands[buildFFmpegCall(ut)] = struct{}{}
- cutoutClipAndTranscode(ut)
- }
- fflines := keysToSlice(ffmpegCommands)
- fmt.Println("# lines: ", len(fflines))
- writeLines(fflines, ffCmdOut)
-
- metadata := readJson(metadataPath)
- newMeta := utterancesToFileTextMap(utterances)
+ filteredUtterances := []*Utterance{}
- for k, v := range newMeta {
- metadata[k] = v
+ for _, ut := range utterances {
+ if _, err := os.Stat(ut.OutPath); os.IsNotExist(err) {
+ if err := cutoutClipAndTranscode(ut); err == nil {
+ filteredUtterances = append(filteredUtterances, ut)
+ }
+ }
}
-
- writeJson(metadata)
- writeCSV(mapToCSV(metadata))
+ newMeta := utterancesToFileTextMap(filteredUtterances)
+ writeCSV(mapToCSV(newMeta))
}