mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-08-25 12:15:26 -07:00
fix(subtitles): recover positioned ASS word spacing and drop control deb
- Recover Latin/romaji word spaces encoded only by positioned `\pos`/`\move` fragment gaps in ASS karaoke - Drop malformed ASS rotation-reset spacer lines and skip zero-duration metadata events - Dedupe duplicate lines across multiline primary/secondary cues, including full-width variants - Treat dense fragment-grid sign layouts as visual typesetting, not publishable text, during primary subtitle resolution
This commit is contained in:
@@ -20,6 +20,32 @@ test('findActiveSubtitleText combines unique simultaneous parsed cues', () => {
|
||||
);
|
||||
});
|
||||
|
||||
test('findActiveSubtitleText removes duplicate lines across multiline cues', () => {
|
||||
assert.equal(
|
||||
findActiveSubtitleText(
|
||||
[
|
||||
{ startTime: 1, endTime: 3, text: 'First line\nSecond line' },
|
||||
{ startTime: 1, endTime: 3, text: 'First line' },
|
||||
],
|
||||
2,
|
||||
),
|
||||
'First line\nSecond line',
|
||||
);
|
||||
});
|
||||
|
||||
test('findActiveSubtitleText removes equivalent full-width duplicate lines', () => {
|
||||
assert.equal(
|
||||
findActiveSubtitleText(
|
||||
[
|
||||
{ startTime: 1, endTime: 3, text: '真白~' },
|
||||
{ startTime: 1, endTime: 3, text: '真白~' },
|
||||
],
|
||||
2,
|
||||
),
|
||||
'真白~',
|
||||
);
|
||||
});
|
||||
|
||||
test('findActiveSubtitleText collapses whitespace variants of one ASS lyric', () => {
|
||||
assert.equal(
|
||||
findActiveSubtitleText(
|
||||
@@ -380,6 +406,23 @@ test('secondary track controller falls back to live mpv text without a readable
|
||||
assert.deepEqual(broadcasts, ['live fallback']);
|
||||
});
|
||||
|
||||
test('secondary live fallback drops malformed ASS control debris', () => {
|
||||
const broadcasts: string[] = [];
|
||||
const controller = createSecondarySubtitleTrackController({
|
||||
getMpvClient: () => null,
|
||||
getCurrentTimePos: () => 2,
|
||||
resolveSubtitleSource: async () => null,
|
||||
loadSubtitleSourceText: async () => '',
|
||||
parseSubtitleCues: () => [],
|
||||
setCurrentSecondaryText: () => {},
|
||||
broadcastSecondaryText: (text) => broadcasts.push(text),
|
||||
});
|
||||
|
||||
controller.handleLiveText('Visible line\n\\\n{\\fr0');
|
||||
|
||||
assert.deepEqual(broadcasts, ['Visible line']);
|
||||
});
|
||||
|
||||
test('secondary track controller reuses parsed cues for an unchanged embedded track', async () => {
|
||||
let resolveCalls = 0;
|
||||
let parseCalls = 0;
|
||||
|
||||
Reference in New Issue
Block a user