From 836bba97cbad395f113d908e259ae22cb8ae5853 Mon Sep 17 00:00:00 2001 From: grumbulon Date: Sun, 15 May 2022 11:33:15 -0400 Subject: [PATCH] Fix cytube rejecting JSON for not correctly formatted videoHeight --- generator.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/generator.ts b/generator.ts index cfe64d5..04042de 100644 --- a/generator.ts +++ b/generator.ts @@ -64,7 +64,17 @@ async function main(): Promise { Deno.exit(1); }); const videoLength = stats.duration; - const videoHeight = stats.height; // Cytube wants this to be specific numbers, nmp + let videoHeight = stats.height as number; // Cytube wants this to be specific numbers, nmp + //cytube freaks out if the height isn't a specific expected number so do some cleanup below + if (videoHeight <= 480) { + videoHeight = 480; + } + if (videoHeight <= 720 && videoHeight > 480) { + videoHeight = 720; + } + if (videoHeight <= 1080 && videoHeight > 720) { + videoHeight = 1080; + } // Convert subtitles to webvtt const subtitlesFile: string = args._[1] as string;