preserve file name for JSON file title field and for VTT file
This commit is contained in:
parent
836bba97cb
commit
cb88d162a8
1 changed files with 5 additions and 3 deletions
|
@ -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,
|
||||
},
|
||||
],
|
||||
|
|
Reference in a new issue