mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-08-01 07:21:33 -07:00
feat(stats): add alass sidecar retiming for sentence mining and fix timi
- Retime local English sidecars against the Japanese sidecar via alass before populating sentence card translation fields; cache retimed copies for the process lifetime - Reject reversed or non-positive subtitle timings in immersion tracker and before media generation - Fix word card mining so sentence audio goes to SentenceAudio (not ExpressionAudio) and English subtitle text is not written to SelectionText - Consolidate 10 individual change fragments into stats-updates.md
This commit is contained in:
@@ -159,6 +159,30 @@ test('mpv subtitle timing handler runs AniList without timing tracker and passes
|
||||
assert.deepEqual(calls, ['immersion:line:899:901', 'post-watch:901']);
|
||||
});
|
||||
|
||||
test('mpv subtitle timing handler skips invalid cue pairs until timing is complete', () => {
|
||||
const calls: string[] = [];
|
||||
const handler = createHandleMpvSubtitleTimingHandler({
|
||||
recordImmersionSubtitleLine: (text, start, end) =>
|
||||
calls.push(`immersion:${text}:${start}:${end}`),
|
||||
hasSubtitleTimingTracker: () => true,
|
||||
recordSubtitleTiming: (text, start, end) => calls.push(`timing:${text}:${start}:${end}`),
|
||||
maybeRunAnilistPostWatchUpdate: async (options) => {
|
||||
calls.push(`post-watch:${options?.watchedSeconds}`);
|
||||
},
|
||||
logError: () => calls.push('error'),
|
||||
});
|
||||
|
||||
handler({ text: 'line', start: 953.991, end: 953.891 });
|
||||
handler({ text: 'line', start: 953.991, end: 956.56 });
|
||||
|
||||
assert.deepEqual(calls, [
|
||||
'post-watch:953.991',
|
||||
'immersion:line:953.991:956.56',
|
||||
'timing:line:953.991:956.56',
|
||||
'post-watch:956.56',
|
||||
]);
|
||||
});
|
||||
|
||||
test('mpv event bindings register all expected events', () => {
|
||||
const seenEvents: string[] = [];
|
||||
const bindHandlers = createBindMpvClientEventHandlers({
|
||||
|
||||
@@ -72,7 +72,7 @@ export function createHandleMpvSubtitleTimingHandler(deps: {
|
||||
Number.isFinite(end) ? end : 0,
|
||||
);
|
||||
const options = watchedSeconds > 0 ? { watchedSeconds } : undefined;
|
||||
if (text.trim()) {
|
||||
if (text.trim() && Number.isFinite(start) && Number.isFinite(end) && end > start) {
|
||||
deps.recordImmersionSubtitleLine(text, start, end);
|
||||
if (deps.hasSubtitleTimingTracker()) {
|
||||
deps.recordSubtitleTiming(text, start, end);
|
||||
|
||||
Reference in New Issue
Block a user