mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-05-26 12:55:16 -07:00
fix autoplay gate to hold pause until subtitle prime and tokenization re
- use pluginRuntimeConfig.autoStart (not effectivePluginRuntimeConfig) so pause-until-ready is preserved when attaching to a background app - await subtitle priming before signaling autoplay readiness - move sub-auto/sid defaults to start-file so they are not overwritten after track load
This commit is contained in:
@@ -261,7 +261,7 @@ test('plugin auto-start playback attaches a warm background app through the laun
|
||||
});
|
||||
|
||||
assert.deepEqual(calls, ['startMpv', 'startOverlay:--show-visible-overlay --texthooker']);
|
||||
assert.equal(receivedStartMpvOptions[0]?.startPaused, false);
|
||||
assert.equal(receivedStartMpvOptions[0]?.startPaused, true);
|
||||
assert.equal(
|
||||
(receivedStartMpvOptions[0]?.runtimePluginConfig as { autoStart?: boolean } | undefined)
|
||||
?.autoStart,
|
||||
|
||||
@@ -228,7 +228,7 @@ export async function runPlaybackCommandWithDeps(
|
||||
: pluginRuntimeConfig;
|
||||
|
||||
const shouldPauseUntilOverlayReady =
|
||||
effectivePluginRuntimeConfig.autoStart &&
|
||||
pluginRuntimeConfig.autoStart &&
|
||||
pluginRuntimeConfig.autoStartVisibleOverlay &&
|
||||
pluginRuntimeConfig.autoStartPauseUntilReady;
|
||||
|
||||
|
||||
@@ -244,6 +244,7 @@ async function waitForFile(filePath: string, timeoutMs = 1500): Promise<void> {
|
||||
if (fs.existsSync(filePath)) return;
|
||||
await new Promise<void>((resolve) => setTimeout(resolve, 50));
|
||||
}
|
||||
throw new Error(`Timed out waiting for file ${filePath} after ${timeoutMs}ms`);
|
||||
}
|
||||
|
||||
async function startFakeControlServer(
|
||||
@@ -270,10 +271,19 @@ const server = net.createServer((socket) => {
|
||||
let buffer = '';
|
||||
socket.on('data', (chunk) => {
|
||||
buffer += chunk.toString('utf8');
|
||||
const line = buffer.split(/\\r?\\n/, 1)[0];
|
||||
if (!line) return;
|
||||
fs.appendFileSync(logPath, line + '\\n');
|
||||
socket.end(JSON.stringify({ ok: true }) + '\\n');
|
||||
let handledLine = false;
|
||||
while (true) {
|
||||
const newlineMatch = buffer.match(/\\r?\\n/);
|
||||
if (!newlineMatch || newlineMatch.index === undefined) break;
|
||||
const line = buffer.slice(0, newlineMatch.index).trim();
|
||||
buffer = buffer.slice(newlineMatch.index + newlineMatch[0].length);
|
||||
if (!line) continue;
|
||||
fs.appendFileSync(logPath, line + '\\n');
|
||||
handledLine = true;
|
||||
}
|
||||
if (handledLine) {
|
||||
socket.end(JSON.stringify({ ok: true }) + '\\n');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user