Fix cytube rejecting JSON for not correctly formatted videoHeight

This commit is contained in:
grumbulon 2022-05-15 11:33:15 -04:00
parent 4ccec057af
commit 836bba97cb
1 changed files with 11 additions and 1 deletions

View File

@ -64,7 +64,17 @@ async function main(): Promise<void> {
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;