mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-16 10:45:53 -07:00
Merge pull request #492 from HaveAGitGat/changes
Add encoder detection logging
This commit is contained in:
commit
bb3b40b50e
2 changed files with 14 additions and 1 deletions
|
|
@ -49,7 +49,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||||
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 hasEncoder = function (_a) {
|
var hasEncoder = function (_a) {
|
||||||
var ffmpegPath = _a.ffmpegPath, encoder = _a.encoder, inputArgs = _a.inputArgs, filter = _a.filter;
|
var ffmpegPath = _a.ffmpegPath, encoder = _a.encoder, inputArgs = _a.inputArgs, filter = _a.filter, args = _a.args;
|
||||||
return __awaiter(void 0, void 0, void 0, function () {
|
return __awaiter(void 0, void 0, void 0, function () {
|
||||||
var exec, isEnabled, err_1;
|
var exec, isEnabled, err_1;
|
||||||
return __generator(this, function (_b) {
|
return __generator(this, function (_b) {
|
||||||
|
|
@ -64,6 +64,8 @@ var hasEncoder = function (_a) {
|
||||||
var command = "".concat(ffmpegPath, " ").concat(inputArgs.join(' ') || '', " -f lavfi -i color=c=black:s=256x256:d=1:r=30")
|
var command = "".concat(ffmpegPath, " ").concat(inputArgs.join(' ') || '', " -f lavfi -i color=c=black:s=256x256:d=1:r=30")
|
||||||
+ " ".concat(filter || '')
|
+ " ".concat(filter || '')
|
||||||
+ " -c:v ".concat(encoder, " -f null /dev/null");
|
+ " -c:v ".concat(encoder, " -f null /dev/null");
|
||||||
|
args.jobLog("Checking for encoder ".concat(encoder, " with command:"));
|
||||||
|
args.jobLog(command);
|
||||||
exec(command, function (
|
exec(command, function (
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
error) {
|
error) {
|
||||||
|
|
@ -76,6 +78,7 @@ var hasEncoder = function (_a) {
|
||||||
})];
|
})];
|
||||||
case 2:
|
case 2:
|
||||||
isEnabled = _b.sent();
|
isEnabled = _b.sent();
|
||||||
|
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 = _b.sent();
|
||||||
|
|
@ -310,6 +313,7 @@ var getEncoder = function (_a) {
|
||||||
encoder: gpuEncoder.encoder,
|
encoder: gpuEncoder.encoder,
|
||||||
inputArgs: gpuEncoder.inputArgs,
|
inputArgs: gpuEncoder.inputArgs,
|
||||||
filter: gpuEncoder.filter,
|
filter: gpuEncoder.filter,
|
||||||
|
args: args,
|
||||||
})];
|
})];
|
||||||
case 2:
|
case 2:
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,13 @@ export const hasEncoder = async ({
|
||||||
encoder,
|
encoder,
|
||||||
inputArgs,
|
inputArgs,
|
||||||
filter,
|
filter,
|
||||||
|
args,
|
||||||
}: {
|
}: {
|
||||||
ffmpegPath: string,
|
ffmpegPath: string,
|
||||||
encoder: string,
|
encoder: string,
|
||||||
inputArgs: string[],
|
inputArgs: string[],
|
||||||
filter: string,
|
filter: string,
|
||||||
|
args: IpluginInputArgs,
|
||||||
}): Promise<boolean> => {
|
}): Promise<boolean> => {
|
||||||
const { exec } = require('child_process');
|
const { exec } = require('child_process');
|
||||||
let isEnabled = false;
|
let isEnabled = false;
|
||||||
|
|
@ -18,6 +20,10 @@ export const hasEncoder = async ({
|
||||||
const command = `${ffmpegPath} ${inputArgs.join(' ') || ''} -f lavfi -i color=c=black:s=256x256:d=1:r=30`
|
const command = `${ffmpegPath} ${inputArgs.join(' ') || ''} -f lavfi -i color=c=black:s=256x256:d=1:r=30`
|
||||||
+ ` ${filter || ''}`
|
+ ` ${filter || ''}`
|
||||||
+ ` -c:v ${encoder} -f null /dev/null`;
|
+ ` -c:v ${encoder} -f null /dev/null`;
|
||||||
|
|
||||||
|
args.jobLog(`Checking for encoder ${encoder} with command:`);
|
||||||
|
args.jobLog(command);
|
||||||
|
|
||||||
exec(command, (
|
exec(command, (
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
error: any,
|
error: any,
|
||||||
|
|
@ -31,6 +37,8 @@ export const hasEncoder = async ({
|
||||||
resolve(true);
|
resolve(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
args.jobLog(`Encoder ${encoder} is ${isEnabled ? 'enabled' : 'disabled'}`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
|
@ -296,6 +304,7 @@ export const getEncoder = async ({
|
||||||
encoder: gpuEncoder.encoder,
|
encoder: gpuEncoder.encoder,
|
||||||
inputArgs: gpuEncoder.inputArgs,
|
inputArgs: gpuEncoder.inputArgs,
|
||||||
filter: gpuEncoder.filter,
|
filter: gpuEncoder.filter,
|
||||||
|
args,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue