Skip to content

Commit

Permalink
Fix for postProcessingCommand always erroring, added PPC status indic…
Browse files Browse the repository at this point in the history
…ator
  • Loading branch information
Inrixia committed Jul 9, 2021
1 parent 8933883 commit eb62cd2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/downloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,14 @@ export default class Downloader {
});
await video.muxffmpegMetadata();
}
if (settings.postProcessingCommand !== '') {
this.updateBar(formattedTitle, { message: `Running post download command "${settings.postProcessingCommand}"...` });
await video.postProcessingCommand().catch((err) => console.log(`An error occurred while executing the postProcessingCommand!\n${err.message}\n`));
}
if (args.headless === true) {
console.log(`${formattedTitle} - Downloaded!`);
this.updateBar(formattedTitle, { message: `Downloaded!` });
this.updateSummaryBar();
} else if (this.mpb !== undefined) this.mpb.done(formattedTitle);
if (settings.postProcessingCommand !== '')
await video.postProcessingCommand().catch((err) => console.log(`An error occurred while executing the postProcessingCommand!\n${err.message}\n`));
} catch (error) {
// Handle errors when downloading nicely
if (retries < 3) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,6 @@ export default class Video {

public async postProcessingCommand(): Promise<void> {
const result = await exec(this.formatString(settings.postProcessingCommand));
if (result.stderr !== undefined) throw new Error(result.stderr);
if (result.stderr !== '') throw new Error(result.stderr);
}
}

0 comments on commit eb62cd2

Please sign in to comment.