Created
September 27, 2022 08:11
-
-
Save FelipeCortez/ed36cf0a4cd1ded6ee28fec373f886ca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(comment | |
(import '[java.time Duration]) | |
@(def subs (slurp "/Users/felipecortez/suboverride.ttml")) | |
(spit "/Users/felipecortez/suboverride-good.ttml" | |
(clojure.string/replace subs #"\d\d:\d\d:\d\d\.\d\d\d" shifted))) | |
(defn shifted [cue-timing] | |
(let [[h m s ms] (map #(Integer/parseInt % 10) (str/split cue-timing #"[:.]")) | |
shifted-ts (-> (Duration/ofMillis (+ ms (* 1000 s) (* 60 1000 m) (* 60 60 1000 h))) | |
(.minusSeconds 6) | |
(.minusMillis 800))] | |
(format "%02d:%02d:%02d.%03d" | |
(.toHoursPart shifted-ts) | |
(.toMinutesPart shifted-ts) | |
(.toSecondsPart shifted-ts) | |
(.toMillisPart shifted-ts)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment