mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-14 09:45:55 -07:00
Apply auto-build changes
This commit is contained in:
parent
d77265fb6a
commit
c3b29ecb77
5 changed files with 216 additions and 102 deletions
|
|
@ -1,10 +1,42 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||||
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||||
|
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||||
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||||
|
function step(op) {
|
||||||
|
if (f) throw new TypeError("Generator is already executing.");
|
||||||
|
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
||||||
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||||
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||||
|
switch (op[0]) {
|
||||||
|
case 0: case 1: t = op; break;
|
||||||
|
case 4: _.label++; return { value: op[1], done: false };
|
||||||
|
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||||
|
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||||
|
default:
|
||||||
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||||
|
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||||
|
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||||
|
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||||
|
if (t[2]) _.ops.pop();
|
||||||
|
_.trys.pop(); continue;
|
||||||
|
}
|
||||||
|
op = body.call(thisArg, _);
|
||||||
|
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||||
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||||
|
}
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.plugin = exports.details = void 0;
|
exports.plugin = exports.details = void 0;
|
||||||
var fs_1 = __importDefault(require("fs"));
|
|
||||||
var fileUtils_1 = require("../../../../FlowHelpers/1.0.0/fileUtils");
|
var fileUtils_1 = require("../../../../FlowHelpers/1.0.0/fileUtils");
|
||||||
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
|
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
|
||||||
var details = function () { return ({
|
var details = function () { return ({
|
||||||
|
|
@ -57,28 +89,36 @@ var details = function () { return ({
|
||||||
}); };
|
}); };
|
||||||
exports.details = details;
|
exports.details = details;
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
var plugin = function (args) {
|
var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function () {
|
||||||
var lib = require('../../../../../methods/lib')();
|
var lib, directory, fileName, fileToCheck, fileDoesExist;
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
|
return __generator(this, function (_a) {
|
||||||
args.inputs = lib.loadDefaultValues(args.inputs, details);
|
switch (_a.label) {
|
||||||
var directory = String(args.inputs.directory).trim() || (0, fileUtils_1.getFileAbosluteDir)(args.inputFileObj._id);
|
case 0:
|
||||||
var fileName = (0, fileUtils_1.getFileName)(args.inputFileObj._id);
|
lib = require('../../../../../methods/lib')();
|
||||||
var fileToCheck = String(args.inputs.fileToCheck).trim();
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
|
||||||
fileToCheck = fileToCheck.replace(/\${fileName}/g, fileName);
|
args.inputs = lib.loadDefaultValues(args.inputs, details);
|
||||||
fileToCheck = fileToCheck.replace(/\${container}/g, (0, fileUtils_1.getContainer)(args.inputFileObj._id));
|
directory = String(args.inputs.directory).trim() || (0, fileUtils_1.getFileAbosluteDir)(args.inputFileObj._id);
|
||||||
fileToCheck = "".concat(directory, "/").concat(fileToCheck);
|
fileName = (0, fileUtils_1.getFileName)(args.inputFileObj._id);
|
||||||
var fileExists = false;
|
fileToCheck = String(args.inputs.fileToCheck).trim();
|
||||||
if (fs_1.default.existsSync(fileToCheck)) {
|
fileToCheck = fileToCheck.replace(/\${fileName}/g, fileName);
|
||||||
fileExists = true;
|
fileToCheck = fileToCheck.replace(/\${container}/g, (0, fileUtils_1.getContainer)(args.inputFileObj._id));
|
||||||
args.jobLog("File exists: ".concat(fileToCheck));
|
fileToCheck = "".concat(directory, "/").concat(fileToCheck);
|
||||||
}
|
fileDoesExist = false;
|
||||||
else {
|
return [4 /*yield*/, (0, fileUtils_1.fileExists)(fileToCheck)];
|
||||||
args.jobLog("File does not exist: ".concat(fileToCheck));
|
case 1:
|
||||||
}
|
if (_a.sent()) {
|
||||||
return {
|
fileDoesExist = true;
|
||||||
outputFileObj: args.inputFileObj,
|
args.jobLog("File exists: ".concat(fileToCheck));
|
||||||
outputNumber: fileExists ? 1 : 2,
|
}
|
||||||
variables: args.variables,
|
else {
|
||||||
};
|
args.jobLog("File does not exist: ".concat(fileToCheck));
|
||||||
};
|
}
|
||||||
|
return [2 /*return*/, {
|
||||||
|
outputFileObj: args.inputFileObj,
|
||||||
|
outputNumber: fileDoesExist ? 1 : 2,
|
||||||
|
variables: args.variables,
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}); };
|
||||||
exports.plugin = plugin;
|
exports.plugin = plugin;
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.plugin = exports.details = void 0;
|
exports.plugin = exports.details = void 0;
|
||||||
|
var fs_1 = require("fs");
|
||||||
var fileMoveOrCopy_1 = __importDefault(require("../../../../FlowHelpers/1.0.0/fileMoveOrCopy"));
|
var fileMoveOrCopy_1 = __importDefault(require("../../../../FlowHelpers/1.0.0/fileMoveOrCopy"));
|
||||||
var fileUtils_1 = require("../../../../FlowHelpers/1.0.0/fileUtils");
|
var fileUtils_1 = require("../../../../FlowHelpers/1.0.0/fileUtils");
|
||||||
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
|
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
|
||||||
|
|
@ -66,11 +67,10 @@ var details = function () { return ({
|
||||||
exports.details = details;
|
exports.details = details;
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function () {
|
var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function () {
|
||||||
var fs, lib, currentPath, orignalFolder, fileName, container, newPath, newPathTmp;
|
var lib, currentPath, orignalFolder, fileName, container, newPath, newPathTmp;
|
||||||
return __generator(this, function (_a) {
|
return __generator(this, function (_a) {
|
||||||
switch (_a.label) {
|
switch (_a.label) {
|
||||||
case 0:
|
case 0:
|
||||||
fs = require('fs');
|
|
||||||
lib = require('../../../../../methods/lib')();
|
lib = require('../../../../../methods/lib')();
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
|
||||||
args.inputs = lib.loadDefaultValues(args.inputs, details);
|
args.inputs = lib.loadDefaultValues(args.inputs, details);
|
||||||
|
|
@ -106,14 +106,17 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
|
||||||
})];
|
})];
|
||||||
case 2:
|
case 2:
|
||||||
_a.sent();
|
_a.sent();
|
||||||
// delete original file
|
return [4 /*yield*/, (0, fileUtils_1.fileExists)(args.originalLibraryFile._id)];
|
||||||
if (fs.existsSync(args.originalLibraryFile._id)
|
|
||||||
&& args.originalLibraryFile._id !== currentPath) {
|
|
||||||
args.jobLog("Deleting original file:".concat(args.originalLibraryFile._id));
|
|
||||||
fs.unlinkSync(args.originalLibraryFile._id);
|
|
||||||
}
|
|
||||||
return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 2000); })];
|
|
||||||
case 3:
|
case 3:
|
||||||
|
if (!((_a.sent())
|
||||||
|
&& args.originalLibraryFile._id !== currentPath)) return [3 /*break*/, 5];
|
||||||
|
args.jobLog("Deleting original file:".concat(args.originalLibraryFile._id));
|
||||||
|
return [4 /*yield*/, fs_1.promises.unlink(args.originalLibraryFile._id)];
|
||||||
|
case 4:
|
||||||
|
_a.sent();
|
||||||
|
_a.label = 5;
|
||||||
|
case 5: return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 2000); })];
|
||||||
|
case 6:
|
||||||
_a.sent();
|
_a.sent();
|
||||||
return [4 /*yield*/, (0, fileMoveOrCopy_1.default)({
|
return [4 /*yield*/, (0, fileMoveOrCopy_1.default)({
|
||||||
operation: 'move',
|
operation: 'move',
|
||||||
|
|
@ -121,7 +124,7 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
|
||||||
destinationPath: newPath,
|
destinationPath: newPath,
|
||||||
args: args,
|
args: args,
|
||||||
})];
|
})];
|
||||||
case 4:
|
case 7:
|
||||||
_a.sent();
|
_a.sent();
|
||||||
return [2 /*return*/, {
|
return [2 /*return*/, {
|
||||||
outputFileObj: {
|
outputFileObj: {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,44 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||||
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||||
|
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||||
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||||
|
function step(op) {
|
||||||
|
if (f) throw new TypeError("Generator is already executing.");
|
||||||
|
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
||||||
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||||
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||||
|
switch (op[0]) {
|
||||||
|
case 0: case 1: t = op; break;
|
||||||
|
case 4: _.label++; return { value: op[1], done: false };
|
||||||
|
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||||
|
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||||
|
default:
|
||||||
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||||
|
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||||
|
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||||
|
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||||
|
if (t[2]) _.ops.pop();
|
||||||
|
_.trys.pop(); continue;
|
||||||
|
}
|
||||||
|
op = body.call(thisArg, _);
|
||||||
|
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||||
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||||
|
}
|
||||||
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.plugin = exports.details = void 0;
|
exports.plugin = exports.details = void 0;
|
||||||
|
var fs_1 = require("fs");
|
||||||
|
var fileUtils_1 = require("../../../../FlowHelpers/1.0.0/fileUtils");
|
||||||
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
|
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
|
||||||
var details = function () { return ({
|
var details = function () { return ({
|
||||||
name: 'Transcode Video File',
|
name: 'Transcode Video File',
|
||||||
|
|
@ -42,21 +80,32 @@ var details = function () { return ({
|
||||||
}); };
|
}); };
|
||||||
exports.details = details;
|
exports.details = details;
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
var plugin = function (args) {
|
var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function () {
|
||||||
var lib = require('../../../../../methods/lib')();
|
var lib, oldFile, newFile;
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
|
return __generator(this, function (_a) {
|
||||||
args.inputs = lib.loadDefaultValues(args.inputs, details);
|
switch (_a.label) {
|
||||||
var fs = require('fs');
|
case 0:
|
||||||
var oldFile = args.inputFileObj._id;
|
lib = require('../../../../../methods/lib')();
|
||||||
var newFile = "".concat(args.inputFileObj._id, ".tmp");
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
|
||||||
if (fs.existsSync(newFile)) {
|
args.inputs = lib.loadDefaultValues(args.inputs, details);
|
||||||
fs.unlinkSync(newFile);
|
oldFile = args.inputFileObj._id;
|
||||||
}
|
newFile = "".concat(args.inputFileObj._id, ".tmp");
|
||||||
fs.copyFileSync(oldFile, newFile);
|
return [4 /*yield*/, (0, fileUtils_1.fileExists)(newFile)];
|
||||||
return {
|
case 1:
|
||||||
outputFileObj: { _id: newFile },
|
if (!_a.sent()) return [3 /*break*/, 3];
|
||||||
outputNumber: 1,
|
return [4 /*yield*/, fs_1.promises.unlink(newFile)];
|
||||||
variables: args.variables,
|
case 2:
|
||||||
};
|
_a.sent();
|
||||||
};
|
_a.label = 3;
|
||||||
|
case 3: return [4 /*yield*/, fs_1.promises.copyFile(oldFile, newFile)];
|
||||||
|
case 4:
|
||||||
|
_a.sent();
|
||||||
|
return [2 /*return*/, {
|
||||||
|
outputFileObj: { _id: newFile },
|
||||||
|
outputNumber: 1,
|
||||||
|
variables: args.variables,
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}); };
|
||||||
exports.plugin = plugin;
|
exports.plugin = plugin;
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,14 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.CLI = exports.getFFmpegVar = void 0;
|
exports.CLI = exports.getFFmpegVar = void 0;
|
||||||
|
var fs_1 = __importDefault(require("fs"));
|
||||||
var cliParsers_1 = require("./cliParsers");
|
var cliParsers_1 = require("./cliParsers");
|
||||||
var fs = require('fs');
|
var fileUtils_1 = require("./fileUtils");
|
||||||
var fancyTimeFormat = function (time) {
|
var fancyTimeFormat = function (time) {
|
||||||
// Hours, minutes and seconds
|
// Hours, minutes and seconds
|
||||||
// eslint-disable-next-line no-bitwise
|
// eslint-disable-next-line no-bitwise
|
||||||
|
|
@ -93,60 +97,71 @@ var CLI = /** @class */ (function () {
|
||||||
this.oldProgress = 0;
|
this.oldProgress = 0;
|
||||||
this.lastProgCheck = 0;
|
this.lastProgCheck = 0;
|
||||||
this.hbPass = 0;
|
this.hbPass = 0;
|
||||||
this.updateETA = function (perc) {
|
this.updateETA = function (perc) { return __awaiter(_this, void 0, void 0, function () {
|
||||||
if (perc > 0) {
|
var n, secsSinceLastCheck, eta, sum, avg, estSize, outputFileSizeInGbytes, singleFileSize, err_1;
|
||||||
if (_this.lastProgCheck === 0) {
|
return __generator(this, function (_a) {
|
||||||
_this.lastProgCheck = new Date().getTime();
|
switch (_a.label) {
|
||||||
_this.oldProgress = perc;
|
case 0:
|
||||||
}
|
if (!(perc > 0)) return [3 /*break*/, 6];
|
||||||
else if (perc !== _this.oldProgress) {
|
if (!(this.lastProgCheck === 0)) return [3 /*break*/, 1];
|
||||||
var n = new Date().getTime();
|
this.lastProgCheck = new Date().getTime();
|
||||||
var secsSinceLastCheck = (n - _this.lastProgCheck) / 1000;
|
this.oldProgress = perc;
|
||||||
if (secsSinceLastCheck > 1) {
|
return [3 /*break*/, 6];
|
||||||
// eta total
|
case 1:
|
||||||
var eta = Math.round((100 / (perc - _this.oldProgress)) * secsSinceLastCheck);
|
if (!(perc !== this.oldProgress)) return [3 /*break*/, 6];
|
||||||
|
n = new Date().getTime();
|
||||||
|
secsSinceLastCheck = (n - this.lastProgCheck) / 1000;
|
||||||
|
if (!(secsSinceLastCheck > 1)) return [3 /*break*/, 6];
|
||||||
|
eta = Math.round((100 / (perc - this.oldProgress)) * secsSinceLastCheck);
|
||||||
// eta remaining
|
// eta remaining
|
||||||
eta *= ((100 - perc) / 100);
|
eta *= ((100 - perc) / 100);
|
||||||
_this.progAVG.push(eta);
|
this.progAVG.push(eta);
|
||||||
// let values = [2, 56, 3, 41, 0, 4, 100, 23];
|
sum = this.progAVG.reduce(
|
||||||
var sum = _this.progAVG.reduce(
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
function (previous, current) { return (current += previous); });
|
function (previous, current) { return (current += previous); });
|
||||||
var avg = sum / _this.progAVG.length;
|
avg = sum / this.progAVG.length;
|
||||||
// est size
|
estSize = 0;
|
||||||
var estSize = 0;
|
outputFileSizeInGbytes = void 0;
|
||||||
var outputFileSizeInGbytes = void 0;
|
_a.label = 2;
|
||||||
try {
|
case 2:
|
||||||
if (fs.existsSync(_this.config.outputFilePath)) {
|
_a.trys.push([2, 4, , 5]);
|
||||||
var singleFileSize = fs.statSync(_this.config.outputFilePath);
|
return [4 /*yield*/, (0, fileUtils_1.fileExists)(this.config.outputFilePath)];
|
||||||
singleFileSize = singleFileSize.size;
|
case 3:
|
||||||
outputFileSizeInGbytes = singleFileSize / (1024 * 1024 * 1024);
|
if (_a.sent()) {
|
||||||
if (outputFileSizeInGbytes !== _this.oldOutSize) {
|
singleFileSize = fs_1.default.statSync(this.config.outputFilePath);
|
||||||
_this.oldOutSize = outputFileSizeInGbytes;
|
// @ts-expect-error type
|
||||||
estSize = outputFileSizeInGbytes
|
singleFileSize = singleFileSize.size;
|
||||||
+ ((100 - perc) / perc) * outputFileSizeInGbytes;
|
// @ts-expect-error type
|
||||||
_this.oldEstSize = estSize;
|
outputFileSizeInGbytes = singleFileSize / (1024 * 1024 * 1024);
|
||||||
}
|
if (outputFileSizeInGbytes !== this.oldOutSize) {
|
||||||
|
this.oldOutSize = outputFileSizeInGbytes;
|
||||||
|
estSize = outputFileSizeInGbytes
|
||||||
|
+ ((100 - perc) / perc) * outputFileSizeInGbytes;
|
||||||
|
this.oldEstSize = estSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (err) {
|
return [3 /*break*/, 5];
|
||||||
// eslint-disable-next-line no-console
|
case 4:
|
||||||
console.log(err);
|
err_1 = _a.sent();
|
||||||
}
|
// eslint-disable-next-line no-console
|
||||||
_this.config.updateWorker({
|
console.log(err_1);
|
||||||
|
return [3 /*break*/, 5];
|
||||||
|
case 5:
|
||||||
|
this.config.updateWorker({
|
||||||
ETA: fancyTimeFormat(avg),
|
ETA: fancyTimeFormat(avg),
|
||||||
outputFileSizeInGbytes: outputFileSizeInGbytes === undefined ? 0 : outputFileSizeInGbytes,
|
outputFileSizeInGbytes: outputFileSizeInGbytes === undefined ? 0 : outputFileSizeInGbytes,
|
||||||
estSize: _this.oldEstSize === undefined ? 0 : _this.oldEstSize,
|
estSize: this.oldEstSize === undefined ? 0 : this.oldEstSize,
|
||||||
});
|
});
|
||||||
if (_this.progAVG.length > 30) {
|
if (this.progAVG.length > 30) {
|
||||||
_this.progAVG.splice(0, 1);
|
this.progAVG.splice(0, 1);
|
||||||
}
|
}
|
||||||
_this.lastProgCheck = n;
|
this.lastProgCheck = n;
|
||||||
_this.oldProgress = perc;
|
this.oldProgress = perc;
|
||||||
}
|
_a.label = 6;
|
||||||
|
case 6: return [2 /*return*/];
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
};
|
}); };
|
||||||
this.parseOutput = function (data) {
|
this.parseOutput = function (data) {
|
||||||
var _a, _b, _c, _d, _e, _f, _g;
|
var _a, _b, _c, _d, _e, _f, _g;
|
||||||
var str = "".concat(data);
|
var str = "".concat(data);
|
||||||
|
|
@ -166,7 +181,7 @@ var CLI = /** @class */ (function () {
|
||||||
hbPass: _this.hbPass,
|
hbPass: _this.hbPass,
|
||||||
});
|
});
|
||||||
if (percentage > 0) {
|
if (percentage > 0) {
|
||||||
_this.updateETA(percentage);
|
void _this.updateETA(percentage);
|
||||||
_this.config.updateWorker({
|
_this.config.updateWorker({
|
||||||
percentage: percentage,
|
percentage: percentage,
|
||||||
});
|
});
|
||||||
|
|
@ -214,7 +229,7 @@ var CLI = /** @class */ (function () {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (percentage > 0) {
|
if (percentage > 0) {
|
||||||
_this.updateETA(percentage);
|
void _this.updateETA(percentage);
|
||||||
_this.config.updateWorker({
|
_this.config.updateWorker({
|
||||||
percentage: percentage,
|
percentage: percentage,
|
||||||
});
|
});
|
||||||
|
|
@ -225,7 +240,7 @@ var CLI = /** @class */ (function () {
|
||||||
str: str,
|
str: str,
|
||||||
});
|
});
|
||||||
if (percentage > 0) {
|
if (percentage > 0) {
|
||||||
_this.updateETA(percentage);
|
void _this.updateETA(percentage);
|
||||||
_this.config.updateWorker({
|
_this.config.updateWorker({
|
||||||
percentage: percentage,
|
percentage: percentage,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,15 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.getScanTypes = exports.getPluginWorkDir = exports.moveFileAndValidate = exports.getFileSize = exports.getSubStem = exports.getFfType = exports.getFileAbosluteDir = exports.getFileName = exports.getContainer = void 0;
|
exports.getScanTypes = exports.getPluginWorkDir = exports.moveFileAndValidate = exports.getFileSize = exports.getSubStem = exports.getFfType = exports.getFileAbosluteDir = exports.getFileName = exports.getContainer = exports.fileExists = void 0;
|
||||||
var fs_1 = require("fs");
|
var fs_1 = require("fs");
|
||||||
|
var fileExists = function (path) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
||||||
|
switch (_a.label) {
|
||||||
|
case 0: return [4 /*yield*/, fs_1.promises.stat(path).catch(function () { return false; })];
|
||||||
|
case 1: return [2 /*return*/, !!(_a.sent())];
|
||||||
|
}
|
||||||
|
}); }); };
|
||||||
|
exports.fileExists = fileExists;
|
||||||
var getContainer = function (filePath) {
|
var getContainer = function (filePath) {
|
||||||
var parts = filePath.split('.');
|
var parts = filePath.split('.');
|
||||||
return parts[parts.length - 1];
|
return parts[parts.length - 1];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue