Skip to content

Support numbered output filenames with %n counters - #225

Draft
ekisu wants to merge 4 commits into
masterfrom
fix/issue-167
Draft

Support numbered output filenames with %n counters#225
ekisu wants to merge 4 commits into
masterfrom
fix/issue-167

Conversation

@ekisu

@ekisu ekisu commented Sep 11, 2026

Copy link
Copy Markdown
Owner

Summary

Support %n and zero-padded counters such as %04n in output_template. Select the first unused filename in the resolved output directory, including the current directory, and document gap/reset semantics.

Counters are captured before media-property expansion so counter-like text in a source filename stays literal. Conditional blocks that remove a counter do not trigger a filename search. Media substitutions use literal replacements for percent characters.

Fixes #167
Tracked in #217.

Verification

  • During implementation, checked padded/unpadded counters, multiple counters, gap reuse, existing files, current-directory collisions, removed conditional counters and percent-containing filenames.
  • Completed two real AVC encodes with clip_%04n: clip_0001.mp4 and clip_0002.mp4 (65,384 bytes each); the first file's SHA-256 remained unchanged.
  • Build and CRLF-aware whitespace checks passed.
  • Removed the standalone compiler-driven test at review request; those checks are not retained automated regression coverage in this PR.

Number selection occurs during formatting; concurrent independent encodes are not atomically reserved. No persistent counter is stored.

Current harness-based verification (supersedes historical test notes)

Rebased onto master 72d9d11, which includes #226 and #227. Tests load the normal built script and drive real mpv.

Three real-encode regressions cover padded sequential names, preserving existing files and filling gaps, and literal counter-looking source filenames. All three fail on the unfixed script. Pinned Nix: 17 tests, 16 passed, 1 existing audio skip.

Latest rebase verification

Rebased onto master 72d9d11 after #227 merged. Normal build and the complete pinned-Nix suite pass, with two expected skips (audio fixture and unavailable optional libaom-av1 encoder).

Review feedback addressed — 2026-09-12

Expanded output-template coverage to 10 focused real-mpv tests, including media placeholders, fractional timestamps, raw properties/fallback/conditions, escaped percent/counters and repeated padded counters. Full pinned-Nix suite: 37 tests, 35 passed and 2 expected skips. GitHub build/test checks pass.
Rebased onto master after #220, #221, #223 and #224 merged.

@ekisu
ekisu changed the base branch from master to test/mpv-integration-harness September 12, 2026 00:54
Base automatically changed from test/mpv-integration-harness to master September 12, 2026 01:03

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add other tests for the output template property

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in d87262b. Added real-encode coverage for %f/%F/%T, fractional start/end timestamps with and without milliseconds, raw property expansion, missing-property fallback, positive/negative conditions (both inclusion and omission), literal percent/escaped counters, mixed escaped percent plus real counters, and repeated differently padded counters. Tests assert expected filenames, decodable output and preserved existing bytes. The 10 focused template tests pass; the full pinned-Nix suite passes 35 tests with 2 expected skips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

%04n output_template naming

1 participant