feat(node-subsync): add missing arg msg
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-03-26 16:42:00 -04:00
parent 411e682eaa
commit 0653a897d7

View file

@ -4,40 +4,52 @@ const SUB_EXT_LENGTH = 7;
const FILE = process.argv[2]; const FILE = process.argv[2];
const BASE_NAME = FILE.substring(
FILE.lastIndexOf('/') + 1,
FILE.length - SUB_EXT_LENGTH,
);
const DIR = FILE.substring(0, FILE.lastIndexOf('/')); const main = () => {
const BASE_NAME = FILE.substring(
FILE.lastIndexOf('/') + 1,
FILE.length - SUB_EXT_LENGTH,
);
readdir(DIR, (_, files) => { const DIR = FILE.substring(0, FILE.lastIndexOf('/'));
const VIDEO = files.filter((f) =>
f.includes(BASE_NAME) &&
!f.endsWith('.nfo') &&
!f.endsWith('.srt'))[0];
let lang = FILE.split('.').at(-2); readdir(DIR, (_, files) => {
const VIDEO = files.filter((f) =>
f.includes(BASE_NAME) &&
!f.endsWith('.nfo') &&
!f.endsWith('.srt'))[0];
if (lang === 'fr') { let lang = FILE.split('.').at(-2);
lang = 'fre';
}
else if (lang === 'en') {
lang = 'eng';
}
const cmd = [ if (lang === 'fr') {
'subsync --cli sync', lang = 'fre';
`--sub-lang ${lang}`, }
`--ref-lang ${lang}`, else if (lang === 'en') {
lang = 'eng';
}
`--sub-file '${FILE}'`, const cmd = [
`--out-file '${FILE}'`, 'subsync --cli sync',
`--ref-file '${VIDEO}'`, `--sub-lang ${lang}`,
`--ref-lang ${lang}`,
'--overwrite', `--sub-file '${FILE}'`,
]; `--out-file '${FILE}'`,
`--ref-file '${VIDEO}'`,
// TODO: actually call the command '--overwrite',
console.log(cmd); ];
});
// TODO: actually call the command
console.log(cmd);
});
};
if (FILE) {
main();
process.exit();
}
else {
console.error('Error: no argument passed');
process.exit(1);
}