mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-15 18:25:54 -07:00
Throw error if video bitrate not found
This commit is contained in:
parent
f89f7c4fcf
commit
98f8172dd0
2 changed files with 16 additions and 0 deletions
|
|
@ -77,15 +77,22 @@ var plugin = function (args) {
|
||||||
greaterThanBits *= 1000000;
|
greaterThanBits *= 1000000;
|
||||||
lessThanBits *= 1000000;
|
lessThanBits *= 1000000;
|
||||||
}
|
}
|
||||||
|
var hasVideoBitrate = false;
|
||||||
if ((_b = (_a = args.inputFileObj) === null || _a === void 0 ? void 0 : _a.mediaInfo) === null || _b === void 0 ? void 0 : _b.track) {
|
if ((_b = (_a = args.inputFileObj) === null || _a === void 0 ? void 0 : _a.mediaInfo) === null || _b === void 0 ? void 0 : _b.track) {
|
||||||
args.inputFileObj.mediaInfo.track.forEach(function (stream) {
|
args.inputFileObj.mediaInfo.track.forEach(function (stream) {
|
||||||
if (stream['@type'] === 'video') {
|
if (stream['@type'] === 'video') {
|
||||||
|
if (stream.BitRate) {
|
||||||
|
hasVideoBitrate = true;
|
||||||
|
}
|
||||||
if (stream.BitRate >= greaterThanBits && stream.BitRate <= lessThanBits) {
|
if (stream.BitRate >= greaterThanBits && stream.BitRate <= lessThanBits) {
|
||||||
isWithinRange = true;
|
isWithinRange = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (!hasVideoBitrate) {
|
||||||
|
throw new Error('Video bitrate not found');
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
outputFileObj: args.inputFileObj,
|
outputFileObj: args.inputFileObj,
|
||||||
outputNumber: isWithinRange ? 1 : 2,
|
outputNumber: isWithinRange ? 1 : 2,
|
||||||
|
|
|
||||||
|
|
@ -82,9 +82,14 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => {
|
||||||
lessThanBits *= 1000000;
|
lessThanBits *= 1000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let hasVideoBitrate = false;
|
||||||
|
|
||||||
if (args.inputFileObj?.mediaInfo?.track) {
|
if (args.inputFileObj?.mediaInfo?.track) {
|
||||||
args.inputFileObj.mediaInfo.track.forEach((stream) => {
|
args.inputFileObj.mediaInfo.track.forEach((stream) => {
|
||||||
if (stream['@type'] === 'video') {
|
if (stream['@type'] === 'video') {
|
||||||
|
if (stream.BitRate) {
|
||||||
|
hasVideoBitrate = true;
|
||||||
|
}
|
||||||
if (stream.BitRate >= greaterThanBits && stream.BitRate <= lessThanBits) {
|
if (stream.BitRate >= greaterThanBits && stream.BitRate <= lessThanBits) {
|
||||||
isWithinRange = true;
|
isWithinRange = true;
|
||||||
}
|
}
|
||||||
|
|
@ -92,6 +97,10 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!hasVideoBitrate) {
|
||||||
|
throw new Error('Video bitrate not found');
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
outputFileObj: args.inputFileObj,
|
outputFileObj: args.inputFileObj,
|
||||||
outputNumber: isWithinRange ? 1 : 2,
|
outputNumber: isWithinRange ? 1 : 2,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue