Skip to content

fix: ignore tiny secondary subtitle overlaps - #183

Merged
tatsumoto-ren merged 2 commits into
Ajatt-Tools:masterfrom
kuator:fix/incidental-secondary-overlap
Sep 4, 2026
Merged

fix: ignore tiny secondary subtitle overlaps#183
tatsumoto-ren merged 2 commits into
Ajatt-Tools:masterfrom
kuator:fix/incidental-secondary-overlap

Conversation

@kuator

@kuator kuator commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Problem

Mpvacious includes every secondary subtitle that overlaps the selected primary
subtitle, even when the overlap is extremely small. This can add an unrelated
line from just before or after the selected dialogue.

Example: tiny overlap

Suppose the selected primary subtitle starts at 10.0 seconds, while the
previous secondary subtitle ends at 10.1 seconds. They overlap by only 0.1
seconds, but mpvacious can still include that previous subtitle in the card.

This change ignores such tiny overlaps. An overlap must cover at least half of
the shorter subtitle. For very short subtitles, it must cover at least 75%.

Example: tracks split dialogue differently

The primary track may split one sentence into two subtitle lines while the
secondary track keeps it as one line, or the other way around. Checking only
the full selected time range can then miss the matching translation.

This change checks both the complete selected range and each primary subtitle
inside it. That lets mpvacious find the matching secondary text without also
accepting barely overlapping neighbouring lines.

Change

  • Ignore secondary subtitles whose overlap is too small to be meaningful.
  • Use a stricter threshold for subtitles shorter than one second.
  • Check individual primary subtitles as well as the full selected range.
  • Return the matching secondary subtitles for the preview.

Tests

Added tests for tiny boundary overlaps, very short subtitles, normal partial
overlaps, and tracks that split the same dialogue differently. The full test
suite passes with luajit tests/run.lua.

@kuator kuator changed the title fix: ignore incidental secondary subtitle overlaps fix: ignore tiny secondary subtitle overlaps Sep 2, 2026
@kuator

kuator commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

#177

@tatsumoto-ren
tatsumoto-ren merged commit a38274d into Ajatt-Tools:master Sep 4, 2026
@tatsumoto-ren

Copy link
Copy Markdown
Member

Thanks!

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