Add compiled changes

make-only-subtitle-default
HaveAGitGat 2 years ago
parent dea6ec25a0
commit 1a9a45e5ed

@ -20,12 +20,10 @@ var details = function () { return ({
label: 'Terms', label: 'Terms',
name: 'terms', name: 'terms',
type: 'string', type: 'string',
// eslint-disable-next-line no-template-curly-in-string
defaultValue: '_720p,_1080p', defaultValue: '_720p,_1080p',
inputUI: { inputUI: {
type: 'text', type: 'text',
}, },
// eslint-disable-next-line no-template-curly-in-string
tooltip: 'Specify terms to check for in file name using comma seperated list e.g. _720p,_1080p', tooltip: 'Specify terms to check for in file name using comma seperated list e.g. _720p,_1080p',
}, },
], ],

@ -20,36 +20,30 @@ var details = function () { return ({
label: 'Terms', label: 'Terms',
name: 'terms', name: 'terms',
type: 'string', type: 'string',
// eslint-disable-next-line no-template-curly-in-string
defaultValue: '_720p,_1080p', defaultValue: '_720p,_1080p',
inputUI: { inputUI: {
type: 'text', type: 'text',
}, },
// eslint-disable-next-line no-template-curly-in-string
tooltip: 'Specify terms to check for in file name using comma seperated list e.g. _720p,_1080p', tooltip: 'Specify terms to check for in file name using comma seperated list e.g. _720p,_1080p',
}, },
{ {
label: 'Pattern (regular expression)', label: 'Pattern (regular expression)',
name: 'pattern', name: 'pattern',
type: 'string', type: 'string',
// eslint-disable-next-line no-template-curly-in-string
defaultValue: '', defaultValue: '',
inputUI: { inputUI: {
type: 'text', type: 'text',
}, },
// eslint-disable-next-line no-template-curly-in-string
tooltip: 'Specify the pattern (regex) to check for in file name e.g. ^Pattern.*mkv$', tooltip: 'Specify the pattern (regex) to check for in file name e.g. ^Pattern.*mkv$',
}, },
{ {
label: 'Include file directory in check', label: 'Include file directory in check',
name: 'includeFileDirectory', name: 'includeFileDirectory',
type: 'boolean', type: 'boolean',
// eslint-disable-next-line no-template-curly-in-string
defaultValue: 'false', defaultValue: 'false',
inputUI: { inputUI: {
type: 'switch', type: 'switch',
}, },
// eslint-disable-next-line no-template-curly-in-string
tooltip: 'Should the terms and patterns be evaluated against the file directory e.g. false, true', tooltip: 'Should the terms and patterns be evaluated against the file directory e.g. false, true',
}, },
], ],
@ -70,18 +64,26 @@ var plugin = function (args) {
var lib = require('../../../../../methods/lib')(); var 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);
var buildArrayInput = function (arrayInput) { var _a, _b; return (_b = (_a = String(arrayInput)) === null || _a === void 0 ? void 0 : _a.trim().split(',')) !== null && _b !== void 0 ? _b : []; }; var terms = String(args.inputs.terms);
var fileName = "".concat((args.inputs.includeFileDirectory ? "".concat((0, fileUtils_1.getFileAbosluteDir)(args.inputFileObj._id), "/") : '') var pattern = String(args.inputs.pattern);
+ (0, fileUtils_1.getFileName)(args.inputFileObj._id), ".").concat((0, fileUtils_1.getContainer)(args.inputFileObj._id)); var includeFileDirectory = args.inputs.includeFileDirectory;
var searchCriteriasArray = buildArrayInput(args.inputs.terms) var fileName = includeFileDirectory
? args.inputFileObj._id
: "".concat((0, fileUtils_1.getFileName)(args.inputFileObj._id), ".").concat((0, fileUtils_1.getContainer)(args.inputFileObj._id));
var searchCriteriasArray = terms.trim().split(',')
.map(function (term) { return term.replace(/[\\^$*+?.()|[\]{}]/g, '\\$&'); }); // https://github.com/tc39/proposal-regex-escaping .map(function (term) { return term.replace(/[\\^$*+?.()|[\]{}]/g, '\\$&'); }); // https://github.com/tc39/proposal-regex-escaping
if (args.inputs.pattern) if (pattern) {
searchCriteriasArray.push(String(args.inputs.pattern)); searchCriteriasArray.push(pattern);
}
var searchCriteriaMatched = searchCriteriasArray var searchCriteriaMatched = searchCriteriasArray
.find(function (searchCriteria) { return new RegExp(searchCriteria).test(fileName); }); .find(function (searchCriteria) { return new RegExp(searchCriteria).test(fileName); });
var isAMatch = searchCriteriaMatched !== undefined; var isAMatch = searchCriteriaMatched !== undefined;
if (isAMatch) if (isAMatch) {
args.jobLog("'".concat(fileName, "' includes '").concat(searchCriteriaMatched, "'")); args.jobLog("'".concat(fileName, "' includes '").concat(searchCriteriaMatched, "'"));
}
else {
args.jobLog("'".concat(fileName, "' does not include any of the terms or patterns"));
}
return { return {
outputFileObj: args.inputFileObj, outputFileObj: args.inputFileObj,
outputNumber: isAMatch ? 1 : 2, outputNumber: isAMatch ? 1 : 2,

Loading…
Cancel
Save