mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-17 03:06:27 -07:00
More accurate hb 2 pass logic
This commit is contained in:
parent
f73157eb82
commit
d949b203e5
4 changed files with 34 additions and 14 deletions
|
|
@ -1,8 +1,10 @@
|
|||
const handbrakeParser = ({
|
||||
str,
|
||||
hbPass,
|
||||
}:
|
||||
{
|
||||
str: string
|
||||
str: string,
|
||||
hbPass: number
|
||||
}): number => {
|
||||
if (typeof str !== 'string') {
|
||||
return 0;
|
||||
|
|
@ -25,13 +27,13 @@ const handbrakeParser = ({
|
|||
const outputNum = Number(output);
|
||||
if (outputNum > 0) {
|
||||
percentage = outputNum;
|
||||
}
|
||||
}
|
||||
|
||||
if (str.includes('task 1 of 2')) {
|
||||
percentage /= 2;
|
||||
} else if (str.includes('task 2 of 2')) {
|
||||
percentage = 50 + (percentage / 2);
|
||||
if (hbPass === 1) {
|
||||
percentage /= 2;
|
||||
} else if (hbPass === 2) {
|
||||
percentage = 50 + (percentage / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return percentage;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue