mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-10 16:00:28 -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
|
|
@ -2,7 +2,7 @@
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.editreadyParser = exports.getFFmpegVar = exports.getFFmpegPercentage = exports.ffmpegParser = exports.handbrakeParser = void 0;
|
||||
var handbrakeParser = function (_a) {
|
||||
var str = _a.str;
|
||||
var str = _a.str, hbPass = _a.hbPass;
|
||||
if (typeof str !== 'string') {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -19,14 +19,14 @@ var handbrakeParser = function (_a) {
|
|||
var outputNum = Number(output);
|
||||
if (outputNum > 0) {
|
||||
percentage = outputNum;
|
||||
if (hbPass === 1) {
|
||||
percentage /= 2;
|
||||
}
|
||||
else if (hbPass === 2) {
|
||||
percentage = 50 + (percentage / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (str.includes('task 1 of 2')) {
|
||||
percentage /= 2;
|
||||
}
|
||||
else if (str.includes('task 2 of 2')) {
|
||||
percentage = 50 + (percentage / 2);
|
||||
}
|
||||
return percentage;
|
||||
};
|
||||
exports.handbrakeParser = handbrakeParser;
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ var CLI = /** @class */ (function () {
|
|||
this.oldEstSize = 0;
|
||||
this.oldProgress = 0;
|
||||
this.lastProgCheck = 0;
|
||||
this.hbPass = 0;
|
||||
this.updateETA = function (perc) {
|
||||
if (perc > 0) {
|
||||
if (_this.lastProgCheck === 0) {
|
||||
|
|
@ -154,8 +155,15 @@ var CLI = /** @class */ (function () {
|
|||
_this.config.jobLog(str);
|
||||
}
|
||||
if (_this.config.cli.toLowerCase().includes('handbrake')) {
|
||||
if (str.includes('task 1 of 2')) {
|
||||
_this.hbPass = 1;
|
||||
}
|
||||
else if (str.includes('task 2 of 2')) {
|
||||
_this.hbPass = 2;
|
||||
}
|
||||
var percentage = (0, cliParsers_1.handbrakeParser)({
|
||||
str: str,
|
||||
hbPass: _this.hbPass,
|
||||
});
|
||||
if (percentage > 0) {
|
||||
_this.updateETA(percentage);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue