mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-09 15:38:19 -07:00
Update Tdarr_Plugin_a9he_New_file_size_check.js
This commit is contained in:
parent
a248759bdc
commit
b65b2dbe55
1 changed files with 4 additions and 2 deletions
|
|
@ -57,11 +57,13 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|||
const sizeText = `New file has size ${newSize.toFixed(3)} MB which is ${ratio}% `
|
||||
+ `of original file size: ${oldSize.toFixed(3)} MB`;
|
||||
|
||||
const getBound = (bound) => (bound / 100) * oldSize;
|
||||
|
||||
const errText = 'New file size not within limits.';
|
||||
if (newSize > (inputs.upperBound / 100) * oldSize) {
|
||||
if (newSize > getBound(inputs.upperBound)) {
|
||||
// Item will be errored in UI
|
||||
throw new Error(`${errText} ${sizeText}. upperBound is ${inputs.upperBound}%`);
|
||||
} else if (newSize < (inputs.lowerBound / 100) * oldSize) {
|
||||
} else if (newSize < getBound(inputs.lowerBound)) {
|
||||
// Item will be errored in UI
|
||||
throw new Error(`${errText} ${sizeText}. lowerBound is ${inputs.lowerBound}%`);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue