mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-15 18:25:54 -07:00
Add filterByBitrate
This commit is contained in:
parent
f4793738a9
commit
31895e8afc
2 changed files with 30 additions and 0 deletions
|
|
@ -19,3 +19,4 @@ module.exports.filterByResolution = importFresh(
|
||||||
"./library/filters/filterByResolution.js"
|
"./library/filters/filterByResolution.js"
|
||||||
);
|
);
|
||||||
module.exports.filterBySize = importFresh("./library/filters/filterBySize.js");
|
module.exports.filterBySize = importFresh("./library/filters/filterBySize.js");
|
||||||
|
module.exports.filterByBitrate = importFresh("./library/filters/filterByBitrate.js");
|
||||||
|
|
|
||||||
29
methods/library/filters/filterByBitrate.js
Normal file
29
methods/library/filters/filterByBitrate.js
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
/* eslint-disable */
|
||||||
|
function filterByBitrate(file, lowerBound, upperBound) {
|
||||||
|
try {
|
||||||
|
if (
|
||||||
|
file.bit_rate >= lowerBound &&
|
||||||
|
file.bit_rate <= upperBound
|
||||||
|
) {
|
||||||
|
var response = {
|
||||||
|
outcome: true,
|
||||||
|
note: `☑File bitrate is within filter limits. \n`,
|
||||||
|
};
|
||||||
|
return response;
|
||||||
|
} else {
|
||||||
|
var response = {
|
||||||
|
outcome: false,
|
||||||
|
note: `☒File bitrate is not within filter limits. \n`,
|
||||||
|
};
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
var response = {
|
||||||
|
outcome: false,
|
||||||
|
note: `library.filters.filterByBitrate error: ${err} \n`,
|
||||||
|
};
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = filterByBitrate;
|
||||||
Loading…
Add table
Add a link
Reference in a new issue