Merge pull request #622 from HaveAGitGat/ext_fix

Make case insensitive
This commit is contained in:
HaveAGitGat 2024-05-06 06:53:17 +01:00 committed by GitHub
commit 09a7edf755
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 655 additions and 659 deletions

View file

@ -54,7 +54,7 @@ jobs:
with: with:
node-version: '18.x' node-version: '18.x'
- run: npm i && npm i -g typescript && rm -rdf ./FlowPlugins && tsc - run: npm i && npm i -g typescript && rm -rdf ./FlowPlugins && tsc -v && tsc
- uses: stefanzweifel/git-auto-commit-action@v5 - uses: stefanzweifel/git-auto-commit-action@v5
with: with:

View file

@ -45,8 +45,8 @@ var plugin = function (args) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign // eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
args.inputs = lib.loadDefaultValues(args.inputs, details); args.inputs = lib.loadDefaultValues(args.inputs, details);
var extensions = String(args.inputs.extensions); var extensions = String(args.inputs.extensions);
var extensionArray = extensions.trim().split(','); var extensionArray = extensions.trim().split(',').map(function (row) { return row.toLowerCase(); });
var extension = (0, fileUtils_1.getContainer)(args.inputFileObj._id); var extension = (0, fileUtils_1.getContainer)(args.inputFileObj._id).toLowerCase();
var extensionMatch = false; var extensionMatch = false;
if (extensionArray.includes(extension)) { if (extensionArray.includes(extension)) {
extensionMatch = true; extensionMatch = true;

View file

@ -150,11 +150,10 @@ var details = function () { return ({
], ],
}); }; }); };
exports.details = details; exports.details = details;
var doOperation = function (_a) { var doOperation = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
var args = _a.args, sourcePath = _a.sourcePath, destinationPath = _a.destinationPath, operation = _a.operation; var args = _b.args, sourcePath = _b.sourcePath, destinationPath = _b.destinationPath, operation = _b.operation;
return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_c) {
return __generator(this, function (_b) { switch (_c.label) {
switch (_b.label) {
case 0: case 0:
args.jobLog("Input path: ".concat(sourcePath)); args.jobLog("Input path: ".concat(sourcePath));
args.jobLog("Output path: ".concat(destinationPath)); args.jobLog("Output path: ".concat(destinationPath));
@ -170,13 +169,12 @@ var doOperation = function (_a) {
args: args, args: args,
})]; })];
case 2: case 2:
_b.sent(); _c.sent();
_b.label = 3; _c.label = 3;
case 3: return [2 /*return*/]; case 3: return [2 /*return*/];
} }
}); });
}); }); };
};
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function () { var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function () {
var lib, _a, keepRelativePath, allFiles, sourceDirectory, outputDirectory, copyOrMove, fileExtensions, outputPath, subStem, sourceDir, filesInDir, i; var lib, _a, keepRelativePath, allFiles, sourceDirectory, outputDirectory, copyOrMove, fileExtensions, outputPath, subStem, sourceDir, filesInDir, i;

View file

@ -69,30 +69,29 @@ var compareOldNew = function (_a) {
+ " cache file of size ".concat(sourceFileSize)); + " cache file of size ".concat(sourceFileSize));
} }
}; };
var tryMove = function (_a) { var tryMove = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
var sourcePath = _a.sourcePath, destinationPath = _a.destinationPath, sourceFileSize = _a.sourceFileSize, args = _a.args;
return __awaiter(void 0, void 0, void 0, function () {
var error, err_2, destinationSize; var error, err_2, destinationSize;
return __generator(this, function (_b) { var sourcePath = _b.sourcePath, destinationPath = _b.destinationPath, sourceFileSize = _b.sourceFileSize, args = _b.args;
switch (_b.label) { return __generator(this, function (_c) {
switch (_c.label) {
case 0: case 0:
args.jobLog("Attempting move from ".concat(sourcePath, " to ").concat(destinationPath, ", method 1")); args.jobLog("Attempting move from ".concat(sourcePath, " to ").concat(destinationPath, ", method 1"));
error = false; error = false;
_b.label = 1; _c.label = 1;
case 1: case 1:
_b.trys.push([1, 3, , 4]); _c.trys.push([1, 3, , 4]);
return [4 /*yield*/, fs_1.promises.rename(sourcePath, destinationPath)]; return [4 /*yield*/, fs_1.promises.rename(sourcePath, destinationPath)];
case 2: case 2:
_b.sent(); _c.sent();
return [3 /*break*/, 4]; return [3 /*break*/, 4];
case 3: case 3:
err_2 = _b.sent(); err_2 = _c.sent();
error = true; error = true;
args.jobLog("File move error: ".concat(JSON.stringify(err_2))); args.jobLog("File move error: ".concat(JSON.stringify(err_2)));
return [3 /*break*/, 4]; return [3 /*break*/, 4];
case 4: return [4 /*yield*/, getSizeBytes(destinationPath)]; case 4: return [4 /*yield*/, getSizeBytes(destinationPath)];
case 5: case 5:
destinationSize = _b.sent(); destinationSize = _c.sent();
compareOldNew({ compareOldNew({
sourceFileSize: sourceFileSize, sourceFileSize: sourceFileSize,
destinationSize: destinationSize, destinationSize: destinationSize,
@ -104,15 +103,13 @@ var tryMove = function (_a) {
return [2 /*return*/, true]; return [2 /*return*/, true];
} }
}); });
}); }); };
};
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
var tryMvdir = function (_a) { var tryMvdir = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
var sourcePath = _a.sourcePath, destinationPath = _a.destinationPath, sourceFileSize = _a.sourceFileSize, args = _a.args;
return __awaiter(void 0, void 0, void 0, function () {
var error, destinationSize; var error, destinationSize;
return __generator(this, function (_b) { var sourcePath = _b.sourcePath, destinationPath = _b.destinationPath, sourceFileSize = _b.sourceFileSize, args = _b.args;
switch (_b.label) { return __generator(this, function (_c) {
switch (_c.label) {
case 0: case 0:
args.jobLog("Attempting move from ".concat(sourcePath, " to ").concat(destinationPath, ", method 2")); args.jobLog("Attempting move from ".concat(sourcePath, " to ").concat(destinationPath, ", method 2"));
error = false; error = false;
@ -130,10 +127,10 @@ var tryMvdir = function (_a) {
}); });
})]; })];
case 1: case 1:
_b.sent(); _c.sent();
return [4 /*yield*/, getSizeBytes(destinationPath)]; return [4 /*yield*/, getSizeBytes(destinationPath)];
case 2: case 2:
destinationSize = _b.sent(); destinationSize = _c.sent();
compareOldNew({ compareOldNew({
sourceFileSize: sourceFileSize, sourceFileSize: sourceFileSize,
destinationSize: destinationSize, destinationSize: destinationSize,
@ -145,15 +142,13 @@ var tryMvdir = function (_a) {
return [2 /*return*/, true]; return [2 /*return*/, true];
} }
}); });
}); }); };
};
// Keep in e.g. https://github.com/HaveAGitGat/Tdarr/issues/858 // Keep in e.g. https://github.com/HaveAGitGat/Tdarr/issues/858
var tyNcp = function (_a) { var tyNcp = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
var sourcePath = _a.sourcePath, destinationPath = _a.destinationPath, sourceFileSize = _a.sourceFileSize, args = _a.args;
return __awaiter(void 0, void 0, void 0, function () {
var error_1, destinationSize; var error_1, destinationSize;
return __generator(this, function (_b) { var sourcePath = _b.sourcePath, destinationPath = _b.destinationPath, sourceFileSize = _b.sourceFileSize, args = _b.args;
switch (_b.label) { return __generator(this, function (_c) {
switch (_c.label) {
case 0: case 0:
if (!args.deps.ncp) return [3 /*break*/, 3]; if (!args.deps.ncp) return [3 /*break*/, 3];
args.jobLog("Attempting copy from ".concat(sourcePath, " to ").concat(destinationPath, " , method 1")); args.jobLog("Attempting copy from ".concat(sourcePath, " to ").concat(destinationPath, " , method 1"));
@ -171,10 +166,10 @@ var tyNcp = function (_a) {
}); });
})]; })];
case 1: case 1:
_b.sent(); _c.sent();
return [4 /*yield*/, getSizeBytes(destinationPath)]; return [4 /*yield*/, getSizeBytes(destinationPath)];
case 2: case 2:
destinationSize = _b.sent(); destinationSize = _c.sent();
compareOldNew({ compareOldNew({
sourceFileSize: sourceFileSize, sourceFileSize: sourceFileSize,
destinationSize: destinationSize, destinationSize: destinationSize,
@ -187,32 +182,30 @@ var tyNcp = function (_a) {
case 3: return [2 /*return*/, false]; case 3: return [2 /*return*/, false];
} }
}); });
}); }); };
}; var tryNormalCopy = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
var tryNormalCopy = function (_a) {
var sourcePath = _a.sourcePath, destinationPath = _a.destinationPath, sourceFileSize = _a.sourceFileSize, args = _a.args;
return __awaiter(void 0, void 0, void 0, function () {
var error, err_3, destinationSize; var error, err_3, destinationSize;
return __generator(this, function (_b) { var sourcePath = _b.sourcePath, destinationPath = _b.destinationPath, sourceFileSize = _b.sourceFileSize, args = _b.args;
switch (_b.label) { return __generator(this, function (_c) {
switch (_c.label) {
case 0: case 0:
args.jobLog("Attempting copy from ".concat(sourcePath, " to ").concat(destinationPath, " , method 2")); args.jobLog("Attempting copy from ".concat(sourcePath, " to ").concat(destinationPath, " , method 2"));
error = false; error = false;
_b.label = 1; _c.label = 1;
case 1: case 1:
_b.trys.push([1, 3, , 4]); _c.trys.push([1, 3, , 4]);
return [4 /*yield*/, fs_1.promises.copyFile(sourcePath, destinationPath)]; return [4 /*yield*/, fs_1.promises.copyFile(sourcePath, destinationPath)];
case 2: case 2:
_b.sent(); _c.sent();
return [3 /*break*/, 4]; return [3 /*break*/, 4];
case 3: case 3:
err_3 = _b.sent(); err_3 = _c.sent();
error = true; error = true;
args.jobLog("File copy error: ".concat(JSON.stringify(err_3))); args.jobLog("File copy error: ".concat(JSON.stringify(err_3)));
return [3 /*break*/, 4]; return [3 /*break*/, 4];
case 4: return [4 /*yield*/, getSizeBytes(destinationPath)]; case 4: return [4 /*yield*/, getSizeBytes(destinationPath)];
case 5: case 5:
destinationSize = _b.sent(); destinationSize = _c.sent();
compareOldNew({ compareOldNew({
sourceFileSize: sourceFileSize, sourceFileSize: sourceFileSize,
destinationSize: destinationSize, destinationSize: destinationSize,
@ -224,41 +217,37 @@ var tryNormalCopy = function (_a) {
return [2 /*return*/, true]; return [2 /*return*/, true];
} }
}); });
}); }); };
}; var cleanSourceFile = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
var cleanSourceFile = function (_a) {
var args = _a.args, sourcePath = _a.sourcePath;
return __awaiter(void 0, void 0, void 0, function () {
var err_4; var err_4;
return __generator(this, function (_b) { var args = _b.args, sourcePath = _b.sourcePath;
switch (_b.label) { return __generator(this, function (_c) {
switch (_c.label) {
case 0: case 0:
_b.trys.push([0, 2, , 3]); _c.trys.push([0, 2, , 3]);
args.jobLog("Deleting source file ".concat(sourcePath)); args.jobLog("Deleting source file ".concat(sourcePath));
return [4 /*yield*/, fs_1.promises.unlink(sourcePath)]; return [4 /*yield*/, fs_1.promises.unlink(sourcePath)];
case 1: case 1:
_b.sent(); _c.sent();
return [3 /*break*/, 3]; return [3 /*break*/, 3];
case 2: case 2:
err_4 = _b.sent(); err_4 = _c.sent();
args.jobLog("Failed to delete source file ".concat(sourcePath, ": ").concat(JSON.stringify(err_4))); args.jobLog("Failed to delete source file ".concat(sourcePath, ": ").concat(JSON.stringify(err_4)));
return [3 /*break*/, 3]; return [3 /*break*/, 3];
case 3: return [2 /*return*/]; case 3: return [2 /*return*/];
} }
}); });
}); }); };
}; var fileMoveOrCopy = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
var fileMoveOrCopy = function (_a) {
var operation = _a.operation, sourcePath = _a.sourcePath, destinationPath = _a.destinationPath, args = _a.args;
return __awaiter(void 0, void 0, void 0, function () {
var sourceFileSize, moved, ncpd, copied; var sourceFileSize, moved, ncpd, copied;
return __generator(this, function (_b) { var operation = _b.operation, sourcePath = _b.sourcePath, destinationPath = _b.destinationPath, args = _b.args;
switch (_b.label) { return __generator(this, function (_c) {
switch (_c.label) {
case 0: case 0:
args.jobLog('Calculating cache file size in bytes'); args.jobLog('Calculating cache file size in bytes');
return [4 /*yield*/, getSizeBytes(sourcePath)]; return [4 /*yield*/, getSizeBytes(sourcePath)];
case 1: case 1:
sourceFileSize = _b.sent(); sourceFileSize = _c.sent();
args.jobLog("".concat(sourceFileSize)); args.jobLog("".concat(sourceFileSize));
if (!(operation === 'move')) return [3 /*break*/, 3]; if (!(operation === 'move')) return [3 /*break*/, 3];
return [4 /*yield*/, tryMove({ return [4 /*yield*/, tryMove({
@ -268,7 +257,7 @@ var fileMoveOrCopy = function (_a) {
sourceFileSize: sourceFileSize, sourceFileSize: sourceFileSize,
})]; })];
case 2: case 2:
moved = _b.sent(); moved = _c.sent();
if (moved) { if (moved) {
return [2 /*return*/, true]; return [2 /*return*/, true];
} }
@ -283,7 +272,7 @@ var fileMoveOrCopy = function (_a) {
// return true; // return true;
// } // }
args.jobLog('Failed to move file, trying copy'); args.jobLog('Failed to move file, trying copy');
_b.label = 3; _c.label = 3;
case 3: return [4 /*yield*/, tyNcp({ case 3: return [4 /*yield*/, tyNcp({
sourcePath: sourcePath, sourcePath: sourcePath,
destinationPath: destinationPath, destinationPath: destinationPath,
@ -291,7 +280,7 @@ var fileMoveOrCopy = function (_a) {
sourceFileSize: sourceFileSize, sourceFileSize: sourceFileSize,
})]; })];
case 4: case 4:
ncpd = _b.sent(); ncpd = _c.sent();
if (!ncpd) return [3 /*break*/, 7]; if (!ncpd) return [3 /*break*/, 7];
if (!(operation === 'move')) return [3 /*break*/, 6]; if (!(operation === 'move')) return [3 /*break*/, 6];
return [4 /*yield*/, cleanSourceFile({ return [4 /*yield*/, cleanSourceFile({
@ -299,8 +288,8 @@ var fileMoveOrCopy = function (_a) {
sourcePath: sourcePath, sourcePath: sourcePath,
})]; })];
case 5: case 5:
_b.sent(); _c.sent();
_b.label = 6; _c.label = 6;
case 6: return [2 /*return*/, true]; case 6: return [2 /*return*/, true];
case 7: return [4 /*yield*/, tryNormalCopy({ case 7: return [4 /*yield*/, tryNormalCopy({
sourcePath: sourcePath, sourcePath: sourcePath,
@ -309,7 +298,7 @@ var fileMoveOrCopy = function (_a) {
sourceFileSize: sourceFileSize, sourceFileSize: sourceFileSize,
})]; })];
case 8: case 8:
copied = _b.sent(); copied = _c.sent();
if (!copied) return [3 /*break*/, 11]; if (!copied) return [3 /*break*/, 11];
if (!(operation === 'move')) return [3 /*break*/, 10]; if (!(operation === 'move')) return [3 /*break*/, 10];
return [4 /*yield*/, cleanSourceFile({ return [4 /*yield*/, cleanSourceFile({
@ -317,12 +306,11 @@ var fileMoveOrCopy = function (_a) {
sourcePath: sourcePath, sourcePath: sourcePath,
})]; })];
case 9: case 9:
_b.sent(); _c.sent();
_b.label = 10; _c.label = 10;
case 10: return [2 /*return*/, true]; case 10: return [2 /*return*/, true];
case 11: throw new Error("Failed to ".concat(operation, " file")); case 11: throw new Error("Failed to ".concat(operation, " file"));
} }
}); });
}); }); };
};
exports.default = fileMoveOrCopy; exports.default = fileMoveOrCopy;

View file

@ -80,15 +80,14 @@ var getFileSize = function (file) { return __awaiter(void 0, void 0, void 0, fun
}); });
}); }; }); };
exports.getFileSize = getFileSize; exports.getFileSize = getFileSize;
var moveFileAndValidate = function (_a) { var moveFileAndValidate = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
var inputPath = _a.inputPath, outputPath = _a.outputPath, args = _a.args;
return __awaiter(void 0, void 0, void 0, function () {
var inputSize, res1, outputSize, err_1, res2, errMessage; var inputSize, res1, outputSize, err_1, res2, errMessage;
return __generator(this, function (_b) { var inputPath = _b.inputPath, outputPath = _b.outputPath, args = _b.args;
switch (_b.label) { return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4 /*yield*/, (0, exports.getFileSize)(inputPath)]; case 0: return [4 /*yield*/, (0, exports.getFileSize)(inputPath)];
case 1: case 1:
inputSize = _b.sent(); inputSize = _c.sent();
args.jobLog("Attempt 1: Moving file from ".concat(inputPath, " to ").concat(outputPath)); args.jobLog("Attempt 1: Moving file from ".concat(inputPath, " to ").concat(outputPath));
return [4 /*yield*/, new Promise(function (resolve) { return [4 /*yield*/, new Promise(function (resolve) {
args.deps.gracefulfs.rename(inputPath, outputPath, function (err) { args.deps.gracefulfs.rename(inputPath, outputPath, function (err) {
@ -103,17 +102,17 @@ var moveFileAndValidate = function (_a) {
}); });
})]; })];
case 2: case 2:
res1 = _b.sent(); res1 = _c.sent();
outputSize = 0; outputSize = 0;
_b.label = 3; _c.label = 3;
case 3: case 3:
_b.trys.push([3, 5, , 6]); _c.trys.push([3, 5, , 6]);
return [4 /*yield*/, (0, exports.getFileSize)(outputPath)]; return [4 /*yield*/, (0, exports.getFileSize)(outputPath)];
case 4: case 4:
outputSize = _b.sent(); outputSize = _c.sent();
return [3 /*break*/, 6]; return [3 /*break*/, 6];
case 5: case 5:
err_1 = _b.sent(); err_1 = _c.sent();
args.jobLog(JSON.stringify(err_1)); args.jobLog(JSON.stringify(err_1));
return [3 /*break*/, 6]; return [3 /*break*/, 6];
case 6: case 6:
@ -135,10 +134,10 @@ var moveFileAndValidate = function (_a) {
}); });
})]; })];
case 7: case 7:
res2 = _b.sent(); res2 = _c.sent();
return [4 /*yield*/, (0, exports.getFileSize)(outputPath)]; return [4 /*yield*/, (0, exports.getFileSize)(outputPath)];
case 8: case 8:
outputSize = _b.sent(); outputSize = _c.sent();
if (!res2 || inputSize !== outputSize) { if (!res2 || inputSize !== outputSize) {
if (inputSize !== outputSize) { if (inputSize !== outputSize) {
args.jobLog("File sizes do not match, input: ".concat(inputSize, " ") args.jobLog("File sizes do not match, input: ".concat(inputSize, " ")
@ -148,12 +147,11 @@ var moveFileAndValidate = function (_a) {
args.jobLog(errMessage); args.jobLog(errMessage);
throw new Error(errMessage); throw new Error(errMessage);
} }
_b.label = 9; _c.label = 9;
case 9: return [2 /*return*/]; case 9: return [2 /*return*/];
} }
}); });
}); }); };
};
exports.moveFileAndValidate = moveFileAndValidate; exports.moveFileAndValidate = moveFileAndValidate;
var getPluginWorkDir = function (args) { var getPluginWorkDir = function (args) {
var pluginWorkDir = "".concat(args.workDir, "/").concat(new Date().getTime()); var pluginWorkDir = "".concat(args.workDir, "/").concat(new Date().getTime());

View file

@ -61,18 +61,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.getEncoder = exports.getBestNvencDevice = exports.hasEncoder = void 0; exports.getEncoder = exports.getBestNvencDevice = exports.hasEncoder = void 0;
var os_1 = __importDefault(require("os")); var os_1 = __importDefault(require("os"));
var hasEncoder = function (_a) { var hasEncoder = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
var ffmpegPath = _a.ffmpegPath, encoder = _a.encoder, inputArgs = _a.inputArgs, outputArgs = _a.outputArgs, filter = _a.filter, args = _a.args;
return __awaiter(void 0, void 0, void 0, function () {
var spawn, isEnabled, commandArr_1, err_1; var spawn, isEnabled, commandArr_1, err_1;
return __generator(this, function (_b) { var ffmpegPath = _b.ffmpegPath, encoder = _b.encoder, inputArgs = _b.inputArgs, outputArgs = _b.outputArgs, filter = _b.filter, args = _b.args;
switch (_b.label) { return __generator(this, function (_c) {
switch (_c.label) {
case 0: case 0:
spawn = require('child_process').spawn; spawn = require('child_process').spawn;
isEnabled = false; isEnabled = false;
_b.label = 1; _c.label = 1;
case 1: case 1:
_b.trys.push([1, 3, , 4]); _c.trys.push([1, 3, , 4]);
commandArr_1 = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], inputArgs, true), [ commandArr_1 = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], inputArgs, true), [
'-f', '-f',
'lavfi', 'lavfi',
@ -122,19 +121,18 @@ var hasEncoder = function (_a) {
} }
})]; })];
case 2: case 2:
isEnabled = _b.sent(); isEnabled = _c.sent();
args.jobLog("Encoder ".concat(encoder, " is ").concat(isEnabled ? 'enabled' : 'disabled')); args.jobLog("Encoder ".concat(encoder, " is ").concat(isEnabled ? 'enabled' : 'disabled'));
return [3 /*break*/, 4]; return [3 /*break*/, 4];
case 3: case 3:
err_1 = _b.sent(); err_1 = _c.sent();
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(err_1); console.log(err_1);
return [3 /*break*/, 4]; return [3 /*break*/, 4];
case 4: return [2 /*return*/, isEnabled]; case 4: return [2 /*return*/, isEnabled];
} }
}); });
}); }); };
};
exports.hasEncoder = hasEncoder; exports.hasEncoder = hasEncoder;
// credit to UNCode101 for this // credit to UNCode101 for this
var getBestNvencDevice = function (_a) { var getBestNvencDevice = function (_a) {
@ -207,12 +205,11 @@ var encoderFilter = function (encoder, targetCodec) {
} }
return false; return false;
}; };
var getEncoder = function (_a) { var getEncoder = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
var targetCodec = _a.targetCodec, hardwareEncoding = _a.hardwareEncoding, hardwareType = _a.hardwareType, args = _a.args; var supportedGpuEncoders, gpuEncoders, filteredGpuEncoders, idx, _i, filteredGpuEncoders_1, gpuEncoder, _c, enabledDevices, res;
return __awaiter(void 0, void 0, void 0, function () { var targetCodec = _b.targetCodec, hardwareEncoding = _b.hardwareEncoding, hardwareType = _b.hardwareType, args = _b.args;
var supportedGpuEncoders, gpuEncoders, filteredGpuEncoders, idx, _i, filteredGpuEncoders_1, gpuEncoder, _b, enabledDevices, res; return __generator(this, function (_d) {
return __generator(this, function (_c) { switch (_d.label) {
switch (_c.label) {
case 0: case 0:
supportedGpuEncoders = ['hevc', 'h264', 'av1']; supportedGpuEncoders = ['hevc', 'h264', 'av1'];
if (!(args.workerType if (!(args.workerType
@ -348,12 +345,12 @@ var getEncoder = function (_a) {
} }
args.jobLog(JSON.stringify({ filteredGpuEncoders: filteredGpuEncoders })); args.jobLog(JSON.stringify({ filteredGpuEncoders: filteredGpuEncoders }));
_i = 0, filteredGpuEncoders_1 = filteredGpuEncoders; _i = 0, filteredGpuEncoders_1 = filteredGpuEncoders;
_c.label = 1; _d.label = 1;
case 1: case 1:
if (!(_i < filteredGpuEncoders_1.length)) return [3 /*break*/, 4]; if (!(_i < filteredGpuEncoders_1.length)) return [3 /*break*/, 4];
gpuEncoder = filteredGpuEncoders_1[_i]; gpuEncoder = filteredGpuEncoders_1[_i];
// eslint-disable-next-line no-await-in-loop // eslint-disable-next-line no-await-in-loop
_b = gpuEncoder; _c = gpuEncoder;
return [4 /*yield*/, (0, exports.hasEncoder)({ return [4 /*yield*/, (0, exports.hasEncoder)({
ffmpegPath: args.ffmpegPath, ffmpegPath: args.ffmpegPath,
encoder: gpuEncoder.encoder, encoder: gpuEncoder.encoder,
@ -364,8 +361,8 @@ var getEncoder = function (_a) {
})]; })];
case 2: case 2:
// eslint-disable-next-line no-await-in-loop // eslint-disable-next-line no-await-in-loop
_b.enabled = _c.sent(); _c.enabled = _d.sent();
_c.label = 3; _d.label = 3;
case 3: case 3:
_i++; _i++;
return [3 /*break*/, 1]; return [3 /*break*/, 1];
@ -399,7 +396,7 @@ var getEncoder = function (_a) {
if (!supportedGpuEncoders.includes(targetCodec)) { if (!supportedGpuEncoders.includes(targetCodec)) {
args.jobLog("Target codec ".concat(targetCodec, " is not supported for GPU encoding")); args.jobLog("Target codec ".concat(targetCodec, " is not supported for GPU encoding"));
} }
_c.label = 6; _d.label = 6;
case 6: case 6:
if (targetCodec === 'hevc') { if (targetCodec === 'hevc') {
return [2 /*return*/, { return [2 /*return*/, {
@ -437,6 +434,5 @@ var getEncoder = function (_a) {
}]; }];
} }
}); });
}); }); };
};
exports.getEncoder = getEncoder; exports.getEncoder = getEncoder;

View file

@ -49,9 +49,9 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => {
args.inputs = lib.loadDefaultValues(args.inputs, details); args.inputs = lib.loadDefaultValues(args.inputs, details);
const extensions = String(args.inputs.extensions); const extensions = String(args.inputs.extensions);
const extensionArray = extensions.trim().split(','); const extensionArray = extensions.trim().split(',').map((row) => row.toLowerCase());
const extension = getContainer(args.inputFileObj._id); const extension = getContainer(args.inputFileObj._id).toLowerCase();
let extensionMatch = false; let extensionMatch = false;

View file

@ -44,11 +44,12 @@ const tests = [
}, },
darwin: { darwin: {
processFile: true, processFile: true,
preset: '-fflags +genpts -hwaccel videotoolbox<io> -map 0 -c:v hevc_videotoolbox -b:v 603k -minrate 452k -maxrate 754k -bufsize 1206k -preset slow -c:a copy -c:s copy -max_muxing_queue_size 9999 -f matroska ', preset: '-fflags +genpts -hwaccel videotoolbox<io> -map 0 -c:v hevc_videotoolbox -b:v 603k -minrate 452k -maxrate 754k -bufsize 1206k -preset slow -c:a copy -c:s copy -max_muxing_queue_size 9999 -f matroska -profile:v 2 -pix_fmt yuv420p10le ',
handBrakeMode: false, handBrakeMode: false,
FFmpegMode: true, FFmpegMode: true,
reQueueAfter: true, reQueueAfter: true,
infoLog: '☑ It looks like the current video bitrate is 1206kbps.\n' infoLog: '☑ It looks like the current video bitrate is 1206kbps.\n'
+ '10 bit encode enabled. Setting VideoToolBox Profile v2 & 10 bit pixel format\n'
+ 'Container for output selected as mkv.\n' + 'Container for output selected as mkv.\n'
+ 'Encode variable bitrate settings:\n' + 'Encode variable bitrate settings:\n'
+ 'Target = 603k\n' + 'Target = 603k\n'
@ -108,13 +109,12 @@ const tests = [
}, },
darwin: { darwin: {
processFile: true, processFile: true,
preset: '-fflags +genpts -hwaccel videotoolbox<io> -map 0 -c:v hevc_videotoolbox -b:v 603k -minrate 452k -maxrate 754k -bufsize 1206k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -f mp4 -profile:v main10 -vf scale_qsv=format=p010le ', preset: '-fflags +genpts -hwaccel videotoolbox<io> -map 0 -c:v hevc_videotoolbox -b:v 603k -minrate 452k -maxrate 754k -bufsize 1206k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -f mp4 -profile:v 2 -pix_fmt yuv420p10le ',
handBrakeMode: false, handBrakeMode: false,
FFmpegMode: true, FFmpegMode: true,
reQueueAfter: true, reQueueAfter: true,
infoLog: 'Input file is not MKV so cannot use mkvpropedit to get new file stats. Continuing but file stats will likely be inaccurate...\n' infoLog: '☑ It looks like the current video bitrate is 1206kbps.\n'
+ '☑ It looks like the current video bitrate is 1206kbps.\n' + '10 bit encode enabled. Setting VideoToolBox Profile v2 & 10 bit pixel format\n'
+ '10 bit encode enabled. Setting Main10 Profile & 10 bit pixel format\n'
+ 'Container for output selected as mp4.\n' + 'Container for output selected as mp4.\n'
+ 'Encode variable bitrate settings:\n' + 'Encode variable bitrate settings:\n'
+ 'Target = 603k\n' + 'Target = 603k\n'
@ -145,7 +145,7 @@ const tests = [
output: { output: {
linux: { linux: {
processFile: true, processFile: true,
preset: '-fflags +genpts -hwaccel_output_format qsv -init_hw_device qsv:hw,child_device_type=vaapi -c:v h264<io> -map 0 -c:v hevc_qsv -b:v 3227k -minrate 2420k -maxrate 4034k -bufsize 6454k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -f matroska -profile:v main10 -pix_fmt p010le ', preset: '-fflags +genpts -hwaccel_output_format qsv -init_hw_device qsv:hw_any,child_device_type=vaapi -c:v h264<io> -map 0 -c:v hevc_qsv -b:v 3227k -minrate 2420k -maxrate 4034k -bufsize 6454k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -f matroska -profile:v main10 -pix_fmt p010le ',
handBrakeMode: false, handBrakeMode: false,
FFmpegMode: true, FFmpegMode: true,
reQueueAfter: true, reQueueAfter: true,
@ -179,13 +179,13 @@ const tests = [
}, },
darwin: { darwin: {
processFile: true, processFile: true,
preset: '-fflags +genpts -c:v h264<io> -map 0 -c:v hevc_videotoolbox -b:v 3227k -minrate 2420k -maxrate 4034k -bufsize 6454k -preset fast -c:a copy -c:s copy -f matroska -profile:v main10 -pix_fmt p010le ', preset: '-fflags +genpts -hwaccel videotoolbox<io> -map 0 -c:v hevc_videotoolbox -b:v 3227k -minrate 2420k -maxrate 4034k -bufsize 6454k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -f matroska -profile:v 2 -pix_fmt yuv420p10le ',
handBrakeMode: false, handBrakeMode: false,
FFmpegMode: true, FFmpegMode: true,
reQueueAfter: true, reQueueAfter: true,
infoLog: '☑ It looks like the current video bitrate is 6454kbps.\n' infoLog: '☑ It looks like the current video bitrate is 6454kbps.\n'
+ 'Input file is 10bit using High10. Disabling hardware decoding to avoid problems.\n' + 'Input file is h264 High10. Hardware Decode not supported.\n'
+ '10 bit encode enabled. Setting Main10 Profile & 10 bit pixel format\n' + '10 bit encode enabled. Setting VideoToolBox Profile v2 & 10 bit pixel format\n'
+ 'Container for output selected as mkv.\n' + 'Container for output selected as mkv.\n'
+ 'Encode variable bitrate settings:\n' + 'Encode variable bitrate settings:\n'
+ 'Target = 3227k\n' + 'Target = 3227k\n'
@ -221,6 +221,7 @@ const tests = [
linux: { linux: {
processFile: true, processFile: true,
preset: '-fflags +genpts -hwaccel qsv -hwaccel_output_format qsv -init_hw_device qsv:hw_any,child_device_type=vaapi -c:v hevc_qsv<io> -map 0 -c:v hevc_qsv -b:v 6000k -minrate 4500k -maxrate 7500k -bufsize 12000k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -f matroska -profile:v main10 -vf scale_qsv=format=p010le,hwupload=extra_hw_frames=64,format=qsv ', preset: '-fflags +genpts -hwaccel qsv -hwaccel_output_format qsv -init_hw_device qsv:hw_any,child_device_type=vaapi -c:v hevc_qsv<io> -map 0 -c:v hevc_qsv -b:v 6000k -minrate 4500k -maxrate 7500k -bufsize 12000k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -f matroska -profile:v main10 -vf scale_qsv=format=p010le,hwupload=extra_hw_frames=64,format=qsv ',
handBrakeMode: false,
FFmpegMode: true, FFmpegMode: true,
reQueueAfter: true, reQueueAfter: true,
infoLog: '☑ It looks like the current video bitrate is 12000kbps.\n' infoLog: '☑ It looks like the current video bitrate is 12000kbps.\n'
@ -255,14 +256,14 @@ const tests = [
}, },
darwin: { darwin: {
processFile: true, processFile: true,
preset: '-fflags +genpts <io> -map 0 -c:v hevc_videotoolbox -b:v 6000k -minrate 4500k -maxrate 7500k -bufsize 12000k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -profile:v main10 -f matroska -profile:v main10 -vf scale_qsv=format=p010le', preset: '-fflags +genpts -hwaccel videotoolbox<io> -map 0 -c:v hevc_videotoolbox -b:v 6000k -minrate 4500k -maxrate 7500k -bufsize 12000k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -f matroska -profile:v 2 -pix_fmt yuv420p10le ',
handBrakeMode: false, handBrakeMode: false,
FFmpegMode: true, FFmpegMode: true,
reQueueAfter: true, reQueueAfter: true,
infoLog: '☑ It looks like the current video bitrate is 12000kbps.\n' infoLog: '☑ It looks like the current video bitrate is 12000kbps.\n'
+ 'Reconvert_hevc is true & the file is already HEVC, VP9 or AV1. Using HEVC specific cutoff of 6000kbps.\n' + 'Reconvert_hevc is true & the file is already HEVC, VP9 or AV1. Using HEVC specific cutoff of 6000kbps.\n'
+ '☒ The file is still above this new cutoff! Reconverting.\n' + '☒ The file is still above this new cutoff! Reconverting.\n'
+ '10 bit encode enabled. Setting Main10 Profile & 10 bit pixel format\n' + '10 bit encode enabled. Setting VideoToolBox Profile v2 & 10 bit pixel format\n'
+ 'Container for output selected as mkv.\n' + 'Container for output selected as mkv.\n'
+ 'Encode variable bitrate settings:\n' + 'Encode variable bitrate settings:\n'
+ 'Target = 6000k\n' + 'Target = 6000k\n'
@ -359,16 +360,19 @@ const tests = [
}, },
darwin: { darwin: {
processFile: true, processFile: true,
preset: '-fflags +genpts -hwaccel videotoolbox<io> -map 0 -c:v hevc_videotoolbox<io> -map 0 -c:v hevc_qsv -load_plugin hevc_hw -b:v 3227k -minrate 2420k -maxrate 4034k -bufsize 6454k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -map -0:3 -map -0:4 -map -0:5 -map -0:6 -f mp4', preset: '-fflags +genpts -hwaccel videotoolbox<io> -map 0 -c:v hevc_videotoolbox -b:v 3227k -minrate 2420k -maxrate 4034k -bufsize 6454k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -map -0:3 -map -0:4 -map -0:5 -map -0:6 -f mp4 -profile:v 2 -pix_fmt yuv420p10le ',
handBrakeMode: false, handBrakeMode: false,
FFmpegMode: true, FFmpegMode: true,
reQueueAfter: true, reQueueAfter: true,
infoLog: '☑ It looks like the current video bitrate is 6454kbps.\n' infoLog: '☑ It looks like the current video bitrate is 6454kbps.\n'
+ '10 bit encode enabled. Setting VideoToolBox Profile v2 & 10 bit pixel format\n'
+ 'Container for output selected as mp4.\n' + 'Container for output selected as mp4.\n'
+ 'Encode variable bitrate settings:\n' + 'Encode variable bitrate settings:\n'
+ 'Target = 3227k\n' + 'Target = 3227k\n'
+ 'Minimum = 2420k\n' + 'Minimum = 2420k\n'
+ 'Maximum = 4034k\n' + 'Maximum = 4034k\n'
+ '==ALERT== OS detected as MAC - This will use VIDEOTOOLBOX to encode which is NOT QSV\n'
+ 'cmds set in extra_qsv_options will be IGNORED!\n'
+ 'File Transcoding...\n', + 'File Transcoding...\n',
container: '.mp4', container: '.mp4',
}, },
@ -425,16 +429,19 @@ const tests = [
}, },
darwin: { darwin: {
processFile: true, processFile: true,
preset: '-fflags +genpts -hwaccel videotoolbox<io> -map 0 -c:v hevc_videotoolbox<io> -map 0 -c:v hevc_qsv -load_plugin hevc_hw -b:v 3227k -minrate 2420k -maxrate 4034k -bufsize 6454k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -map -0:d -map -0:3 -map -0:4 -map -0:5 -f matroska ', preset: '-fflags +genpts -hwaccel videotoolbox<io> -map 0 -c:v hevc_videotoolbox -b:v 3227k -minrate 2420k -maxrate 4034k -bufsize 6454k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -map -0:d -map -0:3 -map -0:4 -map -0:5 -f matroska -profile:v 2 -pix_fmt yuv420p10le ',
handBrakeMode: false, handBrakeMode: false,
FFmpegMode: true, FFmpegMode: true,
reQueueAfter: true, reQueueAfter: true,
infoLog: '☑ It looks like the current video bitrate is 6454kbps.\n' infoLog: '☑ It looks like the current video bitrate is 6454kbps.\n'
+ '10 bit encode enabled. Setting VideoToolBox Profile v2 & 10 bit pixel format\n'
+ 'Container for output selected as mkv.\n' + 'Container for output selected as mkv.\n'
+ 'Encode variable bitrate settings:\n' + 'Encode variable bitrate settings:\n'
+ 'Target = 3227k\n' + 'Target = 3227k\n'
+ 'Minimum = 2420k\n' + 'Minimum = 2420k\n'
+ 'Maximum = 4034k\n' + 'Maximum = 4034k\n'
+ '==ALERT== OS detected as MAC - This will use VIDEOTOOLBOX to encode which is NOT QSV\n'
+ 'cmds set in extra_qsv_options will be IGNORED!\n'
+ 'File Transcoding...\n', + 'File Transcoding...\n',
container: '.mkv', container: '.mkv',
}, },
@ -488,12 +495,12 @@ const tests = [
}, },
darwin: { darwin: {
processFile: true, processFile: true,
preset: '-fflags +genpts -hwaccel videotoolbox<io> -map 0 -c:v hevc_videotoolbox -b:v 603k -minrate 452k -maxrate 754k -bufsize 1206k -preset slow -c:a copy -c:s copy -max_muxing_queue_size 9999 -f matroska ', preset: '-fflags +genpts -hwaccel videotoolbox<io> -map 0 -c:v hevc_videotoolbox -b:v 603k -minrate 452k -maxrate 754k -bufsize 1206k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -f matroska -profile:v 2 -pix_fmt yuv420p10le ',
handBrakeMode: false, handBrakeMode: false,
FFmpegMode: true, FFmpegMode: true,
reQueueAfter: true, reQueueAfter: true,
infoLog: '☑ It looks like the current video bitrate is 1206kbps.\n' infoLog: '☑ It looks like the current video bitrate is 1206kbps.\n'
+ '10 bit encode enabled. Setting Main10 Profile & 10 bit pixel format\n' + '10 bit encode enabled. Setting VideoToolBox Profile v2 & 10 bit pixel format\n'
+ 'Container for output selected as mkv.\n' + 'Container for output selected as mkv.\n'
+ 'Encode variable bitrate settings:\n' + 'Encode variable bitrate settings:\n'
+ 'Target = 603k\n' + 'Target = 603k\n'
@ -526,6 +533,7 @@ const tests = [
linux: { linux: {
processFile: true, processFile: true,
preset: '-fflags +genpts -hwaccel_output_format qsv -init_hw_device qsv:hw_any,child_device_type=vaapi -c:v vc1<io> -map 0 -c:v hevc_qsv -b:v 603k -minrate 452k -maxrate 754k -bufsize 1206k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -f matroska -profile:v main10 -pix_fmt p010le ', preset: '-fflags +genpts -hwaccel_output_format qsv -init_hw_device qsv:hw_any,child_device_type=vaapi -c:v vc1<io> -map 0 -c:v hevc_qsv -b:v 603k -minrate 452k -maxrate 754k -bufsize 1206k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -f matroska -profile:v main10 -pix_fmt p010le ',
handBrakeMode: false,
FFmpegMode: true, FFmpegMode: true,
reQueueAfter: true, reQueueAfter: true,
infoLog: '☑ It looks like the current video bitrate is 1206kbps.\n' infoLog: '☑ It looks like the current video bitrate is 1206kbps.\n'
@ -558,12 +566,13 @@ const tests = [
}, },
darwin: { darwin: {
processFile: true, processFile: true,
preset: '-fflags +genpts -c:v vc1<io> -map 0 -c:v hevc_videotoolbox -b:v 603k -minrate 452k -maxrate 754k -bufsize 1206k -preset slow -c:a copy -c:s copy -max_muxing_queue_size 9999 -f matroska ', preset: '-fflags +genpts -hwaccel videotoolbox<io> -map 0 -c:v hevc_videotoolbox -b:v 603k -minrate 452k -maxrate 754k -bufsize 1206k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -f matroska -profile:v 2 -pix_fmt yuv420p10le ',
handBrakeMode: false, handBrakeMode: false,
FFmpegMode: true, FFmpegMode: true,
reQueueAfter: true, reQueueAfter: true,
infoLog: '☑ It looks like the current video bitrate is 1206kbps.\n' infoLog: '☑ It looks like the current video bitrate is 1206kbps.\n'
+ '10 bit encode enabled. Setting Main10 Profile & 10 bit pixel format\n' + 'Input file is vc1. Hardware Decode not supported.\n'
+ '10 bit encode enabled. Setting VideoToolBox Profile v2 & 10 bit pixel format\n'
+ 'Container for output selected as mkv.\n' + 'Container for output selected as mkv.\n'
+ 'Encode variable bitrate settings:\n' + 'Encode variable bitrate settings:\n'
+ 'Target = 603k\n' + 'Target = 603k\n'
@ -602,6 +611,7 @@ const tests = [
linux: { linux: {
processFile: true, processFile: true,
preset: '-fflags +genpts -hwaccel qsv -hwaccel_output_format qsv -init_hw_device qsv:hw_any,child_device_type=vaapi -c:v h264_qsv<io> -map 0 -c:v hevc_qsv -b:v 6000k -minrate 4500k -maxrate 7500k -bufsize 12000k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -color_primaries bt2020 -color_trc smpte2084 -colorspace bt2020nc -f matroska -profile:v main10 -vf scale_qsv=format=p010le,hwupload=extra_hw_frames=64,format=qsv ', preset: '-fflags +genpts -hwaccel qsv -hwaccel_output_format qsv -init_hw_device qsv:hw_any,child_device_type=vaapi -c:v h264_qsv<io> -map 0 -c:v hevc_qsv -b:v 6000k -minrate 4500k -maxrate 7500k -bufsize 12000k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -color_primaries bt2020 -color_trc smpte2084 -colorspace bt2020nc -f matroska -profile:v main10 -vf scale_qsv=format=p010le,hwupload=extra_hw_frames=64,format=qsv ',
handBrakeMode: false,
FFmpegMode: true, FFmpegMode: true,
reQueueAfter: true, reQueueAfter: true,
infoLog: '☑ It looks like the current video bitrate is 12000kbps.\n' infoLog: '☑ It looks like the current video bitrate is 12000kbps.\n'
@ -634,13 +644,13 @@ const tests = [
}, },
darwin: { darwin: {
processFile: true, processFile: true,
preset: '-fflags +genpts <io> -map 0 -c:v hevc_videotoolbox -b:v 6000k -minrate 4500k -maxrate 7500k -bufsize 12000k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -color_primaries bt2020 -color_trc smpte2084 -colorspace bt2020nc -f matroska -profile:v main10 -vf scale_qsv=format=p010le', preset: '-fflags +genpts -hwaccel videotoolbox<io> -map 0 -c:v hevc_videotoolbox -b:v 6000k -minrate 4500k -maxrate 7500k -bufsize 12000k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -color_primaries bt2020 -color_trc smpte2084 -colorspace bt2020nc -f matroska -profile:v 2 -pix_fmt yuv420p10le ',
handBrakeMode: false, handBrakeMode: false,
FFmpegMode: true, FFmpegMode: true,
reQueueAfter: true, reQueueAfter: true,
infoLog: '☑ It looks like the current video bitrate is 12000kbps.\n' infoLog: '☑ It looks like the current video bitrate is 12000kbps.\n'
+ '==WARNING== This looks to be a HDR file. HDR is supported but correct encoding is not guaranteed.\n' + '==WARNING== This looks to be a HDR file. HDR is supported but correct encoding is not guaranteed.\n'
+ '10 bit encode enabled. Setting Main10 Profile & 10 bit pixel format\n' + '10 bit encode enabled. Setting VideoToolBox Profile v2 & 10 bit pixel format\n'
+ 'Container for output selected as mkv.\n' + 'Container for output selected as mkv.\n'
+ 'Encode variable bitrate settings:\n' + 'Encode variable bitrate settings:\n'
+ 'Target = 6000k\n' + 'Target = 6000k\n'

View file

@ -16,8 +16,10 @@ const stackLog = (err) => {
}; };
const run = async (tests) => { const run = async (tests) => {
try { let errorsEncountered = false;
for (let i = 0; i < tests.length; i += 1) { for (let i = 0; i < tests.length; i += 1) {
try {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(`[${os.platform()}] ${scriptName}: test ${i}`); console.log(`[${os.platform()}] ${scriptName}: test ${i}`);
const test = tests[i]; const test = tests[i];
@ -69,10 +71,14 @@ const run = async (tests) => {
chai.assert.deepEqual(testOutput, expectedOutput); chai.assert.deepEqual(testOutput, expectedOutput);
} }
} }
}
} catch (err) { } catch (err) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
stackLog(err); stackLog(err);
errorsEncountered = true;
}
}
if (errorsEncountered) {
process.exit(1); process.exit(1);
} }
}; };