1
0
mirror of https://github.com/snobu/destreamer.git synced 2026-02-27 00:38:23 +00:00

check for aria existance

changed ffmpeg error message
This commit is contained in:
Luca Armaroli
2020-09-20 02:01:28 +02:00
parent af4725c371
commit 38edbadf4a
2 changed files with 15 additions and 3 deletions

View File

@@ -1,3 +1,5 @@
import { error } from "winston";
/* let's start our error codes up high so we /* let's start our error codes up high so we
don't exit with the wrong message if other modules exit with some code */ don't exit with the wrong message if other modules exit with some code */
export const enum ERROR_CODE { export const enum ERROR_CODE {
@@ -11,7 +13,8 @@ export const enum ERROR_CODE {
NO_ENCRYPTION, NO_ENCRYPTION,
ARIA2C_CRASH, ARIA2C_CRASH,
NO_CONNECT_ARIA2C, NO_CONNECT_ARIA2C,
NO_DEAMON_PORT NO_DEAMON_PORT,
MISSING_ARIA2
} }
@@ -24,8 +27,9 @@ export const errors: {[key: number]: string} = {
[ERROR_CODE.CANCELLED_USER_INPUT]: 'Input was cancelled by user', [ERROR_CODE.CANCELLED_USER_INPUT]: 'Input was cancelled by user',
[ERROR_CODE.MISSING_FFMPEG]: 'FFmpeg is missing!\n' + [ERROR_CODE.MISSING_FFMPEG]: 'FFmpeg is missing! Destreamer requires FFmpeg to merge videos',
'Destreamer requires a fairly recent release of FFmpeg to download videos',
[ERROR_CODE.MISSING_ARIA2]: 'FFmpeg is missing! Destreamer requires Aria2c to download videos',
[ERROR_CODE.UNK_FFMPEG_ERROR]: 'Unknown FFmpeg error', [ERROR_CODE.UNK_FFMPEG_ERROR]: 'Unknown FFmpeg error',

View File

@@ -194,6 +194,14 @@ export function checkRequirements(): void {
catch (e) { catch (e) {
process.exit(ERROR_CODE.MISSING_FFMPEG); process.exit(ERROR_CODE.MISSING_FFMPEG);
} }
try {
const aria2Ver: string = execSync('aria2c --version').toString().split('\n')[0];
logger.verbose(`Using ${aria2Ver}\n`);
}
catch (e) {
process.exit(ERROR_CODE.MISSING_ARIA2);
}
} }