mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-08-16 13:55:51 -07:00
fix(subsync): resolve ffmpeg only when a track needs extraction
Stream subtitles arrive as URLs and are downloaded, never piped through ffmpeg, so demanding an ffmpeg install up front broke stream syncs (and CI, which has no ffmpeg). Resolution is now lazy, scoped to embedded tracks.
This commit is contained in:
+14
-2
@@ -93,11 +93,23 @@ export function getSubsyncConfig(config: SubsyncConfig | undefined): SubsyncReso
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* ffsubsync streams a progress bar to stderr, so an unbounded summary reaches
|
||||
* the OSD (and the error log) as tens of kilobytes of carriage returns. The tail
|
||||
* is the part that says what went wrong.
|
||||
*/
|
||||
const COMMAND_OUTPUT_SUMMARY_LIMIT = 2000;
|
||||
|
||||
function tailForSummary(value: string): string {
|
||||
if (value.length <= COMMAND_OUTPUT_SUMMARY_LIMIT) return value;
|
||||
return `…${value.slice(-COMMAND_OUTPUT_SUMMARY_LIMIT)}`;
|
||||
}
|
||||
|
||||
export function summarizeCommandFailure(command: string, result: CommandResult): string {
|
||||
const parts = [
|
||||
`code=${result.code ?? 'n/a'}`,
|
||||
result.stderr ? `stderr: ${result.stderr}` : '',
|
||||
result.stdout ? `stdout: ${result.stdout}` : '',
|
||||
result.stderr ? `stderr: ${tailForSummary(result.stderr)}` : '',
|
||||
result.stdout ? `stdout: ${tailForSummary(result.stdout)}` : '',
|
||||
result.error ? `error: ${result.error}` : '',
|
||||
]
|
||||
.map((value) => value.trim())
|
||||
|
||||
Reference in New Issue
Block a user