fix(overlay): strip spinner frame from subsync overlay card

- Add overlayBody override to ConfiguredStatusNotificationOptions so overlay/OSD/desktop can diverge
- Extract getSubsyncStatusNotificationOptions() to strip the ASCII spinner frame from the overlay card (OSD keeps it since it renders the raw spinner)
- Add tests for spinner stripping and subsync result notifications
This commit is contained in:
2026-07-31 18:03:26 -07:00
parent b2bbf1ae12
commit 6607c333bc
3 changed files with 81 additions and 10 deletions
@@ -2,6 +2,7 @@ import assert from 'node:assert/strict';
import test from 'node:test';
import {
getPlaybackFeedbackNotificationOptions,
getSubsyncStatusNotificationOptions,
getYoutubeFlowStatusNotificationOptions,
notifyConfiguredStatus,
} from './configured-status-notification';
@@ -158,6 +159,64 @@ test('notifyConfiguredStatus can suppress desktop delivery for progress ticks',
assert.deepEqual(calls, ['overlay:subsync-status:Subsync:Subsync: syncing |:progress:pin']);
});
test('subsync progress keeps the osd spinner frame but strips it from the overlay card', () => {
const calls: string[] = [];
for (const frame of ['|', '/', '-', '\\']) {
const message = `Subsync: syncing ${frame}`;
notifyConfiguredStatus(
message,
{
getNotificationType: () => 'both',
showOsd: (osdMessage) => {
calls.push(`osd:${osdMessage}`);
},
showOverlayNotification: (payload) =>
calls.push(
`overlay:${payload.body}:${payload.variant}:${payload.persistent ? 'pin' : 'auto'}`,
),
showDesktopNotification: (title, options) =>
calls.push(`desktop:${title}:${options.body ?? ''}`),
},
getSubsyncStatusNotificationOptions(message),
);
}
assert.deepEqual(calls, [
'overlay:Subsync: syncing:progress:pin',
'overlay:Subsync: syncing:progress:pin',
'overlay:Subsync: syncing:progress:pin',
'overlay:Subsync: syncing:progress:pin',
]);
calls.length = 0;
notifyConfiguredStatus(
'Subsync: syncing /',
{
getNotificationType: () => 'osd',
showOsd: (osdMessage) => {
calls.push(`osd:${osdMessage}`);
},
showOverlayNotification: (payload) => calls.push(`overlay:${payload.body}`),
showDesktopNotification: (title, options) =>
calls.push(`desktop:${title}:${options.body ?? ''}`),
},
getSubsyncStatusNotificationOptions('Subsync: syncing /'),
);
assert.deepEqual(calls, ['osd:Subsync: syncing /']);
});
test('subsync result notifications keep their message intact', () => {
assert.equal(
getSubsyncStatusNotificationOptions('Subtitle synchronized with ffsubsync').overlayBody,
'Subtitle synchronized with ffsubsync',
);
const failure = getSubsyncStatusNotificationOptions('ffsubsync synchronization failed: boom');
assert.equal(failure.variant, 'error');
assert.equal(failure.overlayBody, 'ffsubsync synchronization failed: boom');
});
test('notifyConfiguredStatus routes feedback through overlay without desktop delivery', () => {
const calls: string[] = [];