fix(node-sub): exit program if video file not found
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
4b7aa78957
commit
8bf6851698
1 changed files with 9 additions and 2 deletions
|
@ -36,10 +36,17 @@ else {
|
|||
function getVideoPath(files: string[]) {
|
||||
const fileName = DIR.split('/').at(-1) ?? '';
|
||||
|
||||
return `${DIR}/${files.filter((f) =>
|
||||
const videoFiles = files.filter((f) =>
|
||||
f.includes(fileName) &&
|
||||
!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[]) {
|
||||
|
|
Loading…
Reference in a new issue