fix(arr): correct alass reference/subtitle argument order
Syncer::run passed [subtitle, video] where alass expects <reference-file> <incorrect-sub-file>; every real invocation failed before comparing timings, silently degrading to SyncState::NotRun.
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -177,7 +177,9 @@ impl Syncer {
|
||||
async fn run(&self, video: &Path, subtitle: &Path, output: &Path) -> Result<()> {
|
||||
let mut command = Command::new(&self.binary);
|
||||
command
|
||||
.args([subtitle, video])
|
||||
// `alass <reference-file> <incorrect-sub-file> <output>`: the
|
||||
// video is the reference, never the other way round.
|
||||
.args([video, subtitle])
|
||||
.arg(output)
|
||||
.stdin(Stdio::null())
|
||||
.stdout(Stdio::null())
|
||||
@@ -327,7 +329,7 @@ mod tests {
|
||||
"1\n00:00:01,000 --> 00:00:02,500\nol\u{e1}\n\n2\n00:00:03,000 --> 00:00:04,000\ntwo lines\nof text\n";
|
||||
|
||||
/// Write an executable fake `alass`. Its body receives the three paths as
|
||||
/// `$1` subtitle, `$2` video and `$3` output.
|
||||
/// `$1` video, `$2` subtitle and `$3` output.
|
||||
async fn fake_binary(dir: &std::path::Path, body: &str) -> std::path::PathBuf {
|
||||
let path = dir.join("alass");
|
||||
let mut file = tokio::fs::File::create(&path)
|
||||
@@ -372,7 +374,7 @@ mod tests {
|
||||
#[tokio::test]
|
||||
async fn an_unchanged_output_is_accepted_with_alass_text() {
|
||||
let dir = tempfile::tempdir().expect("test setup and fake binary succeed");
|
||||
let binary = fake_binary(dir.path(), "cp \"$1\" \"$3\"\n").await;
|
||||
let binary = fake_binary(dir.path(), "cp \"$2\" \"$3\"\n").await;
|
||||
let subtitle = write_subtitle(dir.path(), "in.srt", PLAIN).await;
|
||||
|
||||
let outcome = Syncer::new()
|
||||
|
||||
Reference in New Issue
Block a user