preserve file name for JSON file title field and for VTT file

This commit is contained in:
grumbulon 2022-05-30 21:20:15 -04:00
parent 836bba97cb
commit cb88d162a8

View file

@ -59,7 +59,9 @@ async function main(): Promise<void> {
// 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<void> {
// 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<void> {
{
url: subtitlesUrl,
contentType: "text/vtt",
name: "Subs or shit IDK",
name: subtitleName,
default: true,
},
],