@mkterswingman/5mghost-yonder 0.0.9 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tools/subtitles.js +11 -4
- package/package.json +1 -1
package/dist/tools/subtitles.js
CHANGED
|
@@ -362,6 +362,10 @@ export async function downloadSubtitlesForLanguages(input) {
|
|
|
362
362
|
input.onProgress?.(completed, total);
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
|
+
const hasAnySubtitleFiles = Object.values(filesByFormat).some((files) => files.length > 0);
|
|
366
|
+
if (!hasAnySubtitleFiles) {
|
|
367
|
+
throw new Error(`No subtitles found for requested languages: ${input.languages.join(", ")}`);
|
|
368
|
+
}
|
|
365
369
|
return filesByFormat;
|
|
366
370
|
}
|
|
367
371
|
function isUnavailableSubtitleError(error) {
|
|
@@ -459,6 +463,9 @@ export function registerSubtitleTools(server, config, tokenManager) {
|
|
|
459
463
|
});
|
|
460
464
|
}
|
|
461
465
|
}
|
|
466
|
+
if (results.length === 0) {
|
|
467
|
+
return toolErr("NO_SUBTITLES", `No subtitles found for requested languages: ${langs.join(", ")}`);
|
|
468
|
+
}
|
|
462
469
|
return toolOk({
|
|
463
470
|
status: "completed",
|
|
464
471
|
video_id: videoId,
|
|
@@ -589,13 +596,13 @@ export function registerSubtitleTools(server, config, tokenManager) {
|
|
|
589
596
|
let section = "none";
|
|
590
597
|
for (const line of output.split("\n")) {
|
|
591
598
|
const trimmed = line.trim();
|
|
592
|
-
if (trimmed.
|
|
593
|
-
trimmed.
|
|
599
|
+
if (trimmed.startsWith("[info] Available subtitles") ||
|
|
600
|
+
trimmed.startsWith("Available subtitles")) {
|
|
594
601
|
section = "manual";
|
|
595
602
|
continue;
|
|
596
603
|
}
|
|
597
|
-
if (trimmed.
|
|
598
|
-
trimmed.
|
|
604
|
+
if (trimmed.startsWith("[info] Available automatic captions") ||
|
|
605
|
+
trimmed.startsWith("Available automatic captions")) {
|
|
599
606
|
section = "auto";
|
|
600
607
|
continue;
|
|
601
608
|
}
|