mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-10-27 11:35:23 -07:00
fix(subtitles): follow sub-delay in sidebar, navigation, and overlay matching
Anything comparing time-pos with parsed cues now converts through a shared subtitle-clock helper: the sidebar highlight and click-to-seek, the sub-seek cue sanitizer, overlay/primer line resolution, and the replay pause point after sub-seek.
This commit is contained in:
20 files changed
+177
-41
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import type { SubtitleTimingBlock } from '../../subtitle-timing-tracker';
|
||||
import type { SubtitleMiningContext } from '../../types/subtitle';
|
||||
import { shiftSubtitleRangeToVideoClock } from './subtitle-clock';
|
||||
|
||||
interface SubtitleTimingTrackerLike {
|
||||
getRecentBlocks: (count: number) => string[];
|
||||
@@ -56,21 +57,6 @@ export function handleMultiCopyDigit(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* mpv's `sub-start`/`sub-end` and parsed cues carry the subtitle file's own timestamps,
|
||||
* but mpv plays each line `sub-delay` seconds later (z/x retiming). Media is cut from the
|
||||
* video, so subtitle timings move onto the video clock before they reach mining.
|
||||
*/
|
||||
export function shiftSubtitleRangeToVideoClock<T extends { startTime: number; endTime: number }>(
|
||||
range: T,
|
||||
subDelay: number,
|
||||
): T {
|
||||
if (!Number.isFinite(subDelay) || subDelay === 0) {
|
||||
return range;
|
||||
}
|
||||
return { ...range, startTime: range.startTime + subDelay, endTime: range.endTime + subDelay };
|
||||
}
|
||||
|
||||
/**
|
||||
* Snapshot the live mpv subtitle line and its timings as a mining context. Media
|
||||
* generation can run tens of seconds after the user mines (slow audio extraction),
|
||||
|
||||
Reference in new issue
Block a user