fix(subsync): read subtitle delay before final playback session check

This commit is contained in:
sudacode committed 2026-11-25 21:19:06 -08:00
1 parent 58c0dfaed2
commit 904eccc4e7
2 files changed
+92 -4

No files matched your search

+6 -4
View File
@@ -1589,13 +1589,15 @@ async function runAutoSubsync(deps: TriggerSubsyncFromConfigDeps): Promise<void>
alignment: AlignmentResult,
sourceLabel: string,
): Promise<void> => {
const alreadyInSync = isAlreadyInSync(alignment);
const delayProperty = targetSlot === 'secondary' ? 'secondary-sub-delay' : 'sub-delay';
const activeDelay = alreadyInSync
? parseOptionalNumber(await client.requestProperty(delayProperty).catch(() => null))
: null;
if (!(await isPlaybackSessionUnchanged(client, context, targetTrack, targetSlot))) {
return;
}
if (isAlreadyInSync(alignment)) {
const delayProperty = targetSlot === 'secondary' ? 'secondary-sub-delay' : 'sub-delay';
const activeDelayRaw = await client.requestProperty(delayProperty).catch(() => null);
const activeDelay = parseOptionalNumber(activeDelayRaw);
if (alreadyInSync) {
if (activeDelay !== null && Math.abs(activeDelay) > 0.005) {
client.send({ command: ['set_property', delayProperty, 0] });
deps.showMpvOsd(`Reset subtitle delay to 0s (already in sync with ${sourceLabel})`);