fix(node-sub): exit program if video file not found
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-04-01 18:07:43 -04:00
parent 4b7aa78957
commit 8bf6851698

View file

@ -36,10 +36,17 @@ else {
function getVideoPath(files: string[]) { function getVideoPath(files: string[]) {
const fileName = DIR.split('/').at(-1) ?? ''; const fileName = DIR.split('/').at(-1) ?? '';
return `${DIR}/${files.filter((f) => const videoFiles = files.filter((f) =>
f.includes(fileName) && f.includes(fileName) &&
!f.endsWith('.nfo') && !f.endsWith('.nfo') &&
!f.endsWith('.srt'))[0]}`; !f.endsWith('.srt'));
if (videoFiles.length === 0) {
console.warn('No video files were found');
process.exit(0);
}
return `${DIR}/${videoFiles[0]}`;
} }
async function backupSubs(files: string[]) { async function backupSubs(files: string[]) {