make --nocleanup work for encrypted files

This commit is contained in:
AnimeDL 2024-01-29 20:29:42 -08:00
parent 1b5dfa0f3e
commit 169d48aa47
2 changed files with 7 additions and 2 deletions

View file

@ -31,6 +31,7 @@ export type CrunchyDownloadOptions = {
dlVideoOnce: boolean,
skipmux?: boolean,
syncTiming: boolean,
nocleanup: boolean,
apiType: 'web' | 'android'
}

View file

@ -1583,7 +1583,9 @@ export default class Crunchy implements ServiceClass {
return undefined;
} else {
console.info('Decryption done for video');
fs.removeSync(`${tsFile}.video.enc.ts`);
if (!options.nocleanup) {
fs.removeSync(`${tsFile}.video.enc.ts`);
}
files.push({
type: 'Video',
path: `${tsFile}.video.ts`,
@ -1601,7 +1603,9 @@ export default class Crunchy implements ServiceClass {
console.error(`Decryption failed with exit code ${decryptAudio.err.code}`);
return undefined;
} else {
fs.removeSync(`${tsFile}.audio.enc.ts`);
if (!options.nocleanup) {
fs.removeSync(`${tsFile}.audio.enc.ts`);
}
files.push({
type: 'Audio',
path: `${tsFile}.audio.ts`,