From cb88d162a882053838fa950c8502d74542817ec3 Mon Sep 17 00:00:00 2001 From: grumbulon Date: Mon, 30 May 2022 21:20:15 -0400 Subject: [PATCH] preserve file name for JSON file title field and for VTT file --- generator.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/generator.ts b/generator.ts index 04042de..cca53ef 100644 --- a/generator.ts +++ b/generator.ts @@ -59,7 +59,9 @@ async function main(): Promise { // Get video file length const videoFile: string = args._[0] as string; - const videoName = videoFile.split("/").pop()!.split(".")[0] as string; + + //preserve file name for JSON file and strip file extension and final . + const videoName = videoFile.split('/').pop()!.slice(0,videoFile.length-4) as string; const stats = await ffprobe(videoFile).catch(() => { Deno.exit(1); }); @@ -91,7 +93,7 @@ async function main(): Promise { // Upload the subtitles const subtitlesUrl = await upload(`./${videoName}.vtt`); - + const subtitleName = `${videoName}.vtt` // Generate the JSON const json = { title: videoName, @@ -107,7 +109,7 @@ async function main(): Promise { { url: subtitlesUrl, contentType: "text/vtt", - name: "Subs or shit IDK", + name: subtitleName, default: true, }, ],