Skip to content

Fix colon-format timecode regexes rejecting >2-digit hours#45

Merged
OwenYou merged 4 commits into
mainfrom
bugfix/timecode-hours-over-2-digits
Jul 8, 2026
Merged

Fix colon-format timecode regexes rejecting >2-digit hours#45
OwenYou merged 4 commits into
mainfrom
bugfix/timecode-hours-over-2-digits

Conversation

@WheheoHu

@WheheoHu WheheoHu commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

The hours capture group in all colon-separated timecode patterns was (\d\d{1}) (exactly two digits), so non-strict timecodes exceeding 99 hours (e.g. 100:00:00:00) failed to match at the regex layer and raised DFTTTimecodeTypeError before any strict/non-strict handling ran.

Change the hours group to (\d{2,}) (2-or-more digits, unbounded) in SMPTE_NDF/DF/union, SRT, FFMPEG, and DLP patterns. Keeping the {2,} lower bound preserves the zero-pad requirement, so unpadded single-digit hours (1:00:00:00) are still rejected. The output side already handled large hours ({:02d} is a minimum width), so no core changes were needed.

Add tests covering >2- and 4-digit hours across all colon formats plus a regression guard for single-digit rejection.

WheheoHu and others added 3 commits July 6, 2026 13:23
The hours capture group in all colon-separated timecode patterns was
`(\d\d{1})` (exactly two digits), so non-strict timecodes exceeding 99
hours (e.g. `100:00:00:00`) failed to match at the regex layer and raised
DFTTTimecodeTypeError before any strict/non-strict handling ran.

Change the hours group to `(\d{2,})` (2-or-more digits, unbounded) in
SMPTE_NDF/DF/union, SRT, FFMPEG, and DLP patterns. Keeping the `{2,}`
lower bound preserves the zero-pad requirement, so unpadded single-digit
hours (`1:00:00:00`) are still rejected. The output side already handled
large hours (`{:02d}` is a minimum width), so no core changes were needed.

Add tests covering >2- and 4-digit hours across all colon formats plus a
regression guard for single-digit rejection.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Commit c0b77be lifted the exactly-2-digit (max 99h) limit on the hours
field of colon-separated timecodes, so the documented "-99 to 99 hours"
range is no longer accurate.

- index.rst: reword the "Extended Time Range" feature bullet to describe
  unbounded, zero-padded hours (e.g. 100:00:00:00)
- zh_CN index.po/.mo: update the msgid to mirror the new source and
  retranslate the msgstr
- CHANGELOG: add a bilingual [Unreleased] Fixed entry for the regex fix

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The .mo files are binary artifacts compiled from the .po sources. Sphinx
auto-compiles .po -> .mo at build time (gettext_auto_build defaults to
True), and CI's `make html-all` builds the translated site that way, so
the committed .mo files are redundant and only add binary churn to diffs.

Remove them from version control (files remain on disk) and ignore
locale/**/*.mo. The .po files remain the tracked source of truth.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread CHANGELOG.md
The lifted 99-hour cap on colon-separated timecodes reads as a new
capability rather than a defect fix, so move the [Unreleased] entry from
Fixed to Added and reword it in feature terms (both en and zh).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@OwenYou
OwenYou self-requested a review July 8, 2026 04:49
@OwenYou
OwenYou merged commit b80bf43 into main Jul 8, 2026
2 checks passed
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.

2 participants