fix: ignore tiny secondary subtitle overlaps - #183
Merged
tatsumoto-ren merged 2 commits intoSep 4, 2026
Conversation
Contributor
Author
Member
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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.