mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-16 02:35:54 -07:00
Apply auto-build changes
This commit is contained in:
parent
6ac8019e1d
commit
98659977b9
1 changed files with 35 additions and 20 deletions
|
|
@ -40,7 +40,7 @@ exports.runClassicPlugin = void 0;
|
||||||
var fs_1 = require("fs");
|
var fs_1 = require("fs");
|
||||||
var fileUtils_1 = require("./fileUtils");
|
var fileUtils_1 = require("./fileUtils");
|
||||||
var runClassicPlugin = function (args, type) { return __awaiter(void 0, void 0, void 0, function () {
|
var runClassicPlugin = function (args, type) { return __awaiter(void 0, void 0, void 0, function () {
|
||||||
var path, pluginSourceId, parts, pluginSource, pluginId, relativePluginPath, absolutePath, classicPlugin, pluginSrcStr, res, container, cacheFilePath, scanTypes, pluginInputFileObj, originalLibraryFile, otherArguments, result;
|
var path, pluginSourceId, parts, pluginSource, pluginId, relativePluginPath, absolutePath, classicPlugin, pluginSrcStr, res, container, cacheFilePath, scanTypes, pluginInputFileObj, originalLibraryFile, inputFileScanArgs, originalLibraryFileScanArgs, otherArguments, result;
|
||||||
var _a;
|
var _a;
|
||||||
return __generator(this, function (_b) {
|
return __generator(this, function (_b) {
|
||||||
switch (_b.label) {
|
switch (_b.label) {
|
||||||
|
|
@ -99,28 +99,43 @@ var runClassicPlugin = function (args, type) { return __awaiter(void 0, void 0,
|
||||||
container = (0, fileUtils_1.getContainer)(args.inputFileObj._id);
|
container = (0, fileUtils_1.getContainer)(args.inputFileObj._id);
|
||||||
cacheFilePath = "".concat((0, fileUtils_1.getPluginWorkDir)(args), "/").concat((0, fileUtils_1.getFileName)(args.inputFileObj._id), ".").concat(container);
|
cacheFilePath = "".concat((0, fileUtils_1.getPluginWorkDir)(args), "/").concat((0, fileUtils_1.getFileName)(args.inputFileObj._id), ".").concat(container);
|
||||||
scanTypes = (0, fileUtils_1.getScanTypes)([pluginSrcStr]);
|
scanTypes = (0, fileUtils_1.getScanTypes)([pluginSrcStr]);
|
||||||
return [4 /*yield*/, args.deps.axiosMiddleware('api/v2/scan-individual-file', {
|
inputFileScanArgs = {
|
||||||
file: {
|
_id: args.inputFileObj._id,
|
||||||
_id: args.inputFileObj._id,
|
file: args.inputFileObj.file,
|
||||||
file: args.inputFileObj.file,
|
DB: args.inputFileObj.DB,
|
||||||
DB: args.inputFileObj.DB,
|
footprintId: args.inputFileObj.footprintId,
|
||||||
footprintId: args.inputFileObj.footprintId,
|
};
|
||||||
},
|
originalLibraryFileScanArgs = {
|
||||||
scanTypes: scanTypes,
|
_id: args.originalLibraryFile._id,
|
||||||
})];
|
file: args.originalLibraryFile.file,
|
||||||
|
DB: args.originalLibraryFile.DB,
|
||||||
|
footprintId: args.originalLibraryFile.footprintId,
|
||||||
|
};
|
||||||
|
if (!(typeof args.scanIndividualFile !== 'undefined')) return [3 /*break*/, 12];
|
||||||
|
args.jobLog('Scanning files using Node');
|
||||||
|
return [4 /*yield*/, args.scanIndividualFile(inputFileScanArgs, scanTypes)];
|
||||||
case 10:
|
case 10:
|
||||||
pluginInputFileObj = _b.sent();
|
pluginInputFileObj = _b.sent();
|
||||||
return [4 /*yield*/, args.deps.axiosMiddleware('api/v2/scan-individual-file', {
|
return [4 /*yield*/, args.scanIndividualFile(originalLibraryFileScanArgs, scanTypes)];
|
||||||
file: {
|
|
||||||
_id: args.originalLibraryFile._id,
|
|
||||||
file: args.originalLibraryFile.file,
|
|
||||||
DB: args.originalLibraryFile.DB,
|
|
||||||
footprintId: args.originalLibraryFile.footprintId,
|
|
||||||
},
|
|
||||||
scanTypes: scanTypes,
|
|
||||||
})];
|
|
||||||
case 11:
|
case 11:
|
||||||
originalLibraryFile = _b.sent();
|
originalLibraryFile = _b.sent();
|
||||||
|
return [3 /*break*/, 15];
|
||||||
|
case 12:
|
||||||
|
args.jobLog('Scanning files using Server API');
|
||||||
|
return [4 /*yield*/, args.deps.axiosMiddleware('api/v2/scan-individual-file', {
|
||||||
|
file: inputFileScanArgs,
|
||||||
|
scanTypes: scanTypes,
|
||||||
|
})];
|
||||||
|
case 13:
|
||||||
|
pluginInputFileObj = _b.sent();
|
||||||
|
return [4 /*yield*/, args.deps.axiosMiddleware('api/v2/scan-individual-file', {
|
||||||
|
file: originalLibraryFileScanArgs,
|
||||||
|
scanTypes: scanTypes,
|
||||||
|
})];
|
||||||
|
case 14:
|
||||||
|
originalLibraryFile = _b.sent();
|
||||||
|
_b.label = 15;
|
||||||
|
case 15:
|
||||||
otherArguments = {
|
otherArguments = {
|
||||||
handbrakePath: args.handbrakePath,
|
handbrakePath: args.handbrakePath,
|
||||||
ffmpegPath: args.ffmpegPath,
|
ffmpegPath: args.ffmpegPath,
|
||||||
|
|
@ -135,7 +150,7 @@ var runClassicPlugin = function (args, type) { return __awaiter(void 0, void 0,
|
||||||
job: args.job,
|
job: args.job,
|
||||||
};
|
};
|
||||||
return [4 /*yield*/, classicPlugin.plugin(pluginInputFileObj, args.librarySettings, args.inputs, otherArguments)];
|
return [4 /*yield*/, classicPlugin.plugin(pluginInputFileObj, args.librarySettings, args.inputs, otherArguments)];
|
||||||
case 12:
|
case 16:
|
||||||
result = _b.sent();
|
result = _b.sent();
|
||||||
if (((_a = result === null || result === void 0 ? void 0 : result.file) === null || _a === void 0 ? void 0 : _a._id) && args.inputFileObj._id !== result.file._id) {
|
if (((_a = result === null || result === void 0 ? void 0 : result.file) === null || _a === void 0 ? void 0 : _a._id) && args.inputFileObj._id !== result.file._id) {
|
||||||
// eslint-disable-next-line no-param-reassign
|
// eslint-disable-next-line no-param-reassign
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue