feat: report STRM tree batch progress

This commit is contained in:
ShukeBta
2026-07-02 21:48:53 +08:00
parent 87928cfa4d
commit 1afc69baa0
5 changed files with 30 additions and 10 deletions
@@ -155,6 +155,9 @@ func TestGenerateSTRMFromTreeBatchLimitContinuesAfterExistingFiles(t *testing.T)
if first.Generated != 2 || first.Skipped != 0 {
t.Fatalf("first batch = %#v, want two generated", first)
}
if first.Total != 3 || first.Remaining != 1 || !first.BatchLimited {
t.Fatalf("first batch progress = total %d remaining %d limited %v, want 3/1/true", first.Total, first.Remaining, first.BatchLimited)
}
if _, err := os.Stat(filepath.Join(outDir, "Movies", "C.strm")); !os.IsNotExist(err) {
t.Fatalf("first batch should not write third item, stat err=%v", err)
}
@@ -166,6 +169,9 @@ func TestGenerateSTRMFromTreeBatchLimitContinuesAfterExistingFiles(t *testing.T)
if second.Generated != 1 || second.Skipped != 2 {
t.Fatalf("second batch = %#v, want two existing skips then next generated", second)
}
if second.Total != 3 || second.Remaining != 0 || second.BatchLimited {
t.Fatalf("second batch progress = total %d remaining %d limited %v, want 3/0/false", second.Total, second.Remaining, second.BatchLimited)
}
if got := readSTRM(t, filepath.Join(outDir, "Movies", "C.strm")); !strings.Contains(got, "C.mkv") {
t.Fatalf("second batch C.strm = %q, want generated third item", got)
}