cuekit and cuenorm: three subtitle formats, one cue stream

This commit is contained in:
funkpower
2026-09-19 11:54:36 -04:00
parent 33c2e40a1a
commit c7d0767376
42 changed files with 1433 additions and 68 deletions
+17 -1
View File
@@ -19,12 +19,13 @@ type Written = Result<Vec<String>, String>;
type Job = (&'static str, fn() -> Written);
fn main() -> ExitCode {
let jobs: [Job; 5] = [
let jobs: [Job; 6] = [
("tokens", tokens),
("unescape", unescape),
("chunkmd", chunkmd),
("mdscrub", mdscrub),
("pdftriage", pdftriage),
("cuenorm", cuenorm),
];
for (name, job) in jobs {
@@ -68,6 +69,21 @@ fn unescape() -> Written {
Ok(vec![path.display().to_string()])
}
fn cuenorm() -> Written {
let dir = parity::golden("cuenorm");
std::fs::create_dir_all(&dir).map_err(|e| e.to_string())?;
let mut written = Vec::new();
for case in parity::cases_with_extension("cuenorm", "srt") {
let content = std::fs::read_to_string(&case).map_err(|e| e.to_string())?;
let cues = parity::run_node_oracle("cuenorm.mjs", &content)?;
let path = dir.join(format!("{}.ndjson", parity::case_name(&case)));
std::fs::write(&path, cues).map_err(|e| e.to_string())?;
written.push(path.display().to_string());
}
Ok(written)
}
fn pdftriage() -> Written {
let dir = parity::golden("pdftriage");
std::fs::create_dir_all(&dir).map_err(|e| e.to_string())?;