Update flows

This commit is contained in:
HaveAGitGat 2023-08-26 17:53:07 +01:00
parent 658857fdf4
commit 25c4fab8d9
73 changed files with 4295 additions and 839 deletions

View file

@ -0,0 +1,57 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.plugin = exports.details = void 0;
var fileUtils_1 = require("../../../../FlowHelpers/1.0.0/fileUtils");
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
var details = function () { return ({
name: 'Check File Extension',
description: 'Check file extension',
style: {
borderColor: 'orange',
},
tags: 'video',
isStartPlugin: false,
sidebarPosition: -1,
icon: 'faQuestion',
inputs: [
{
name: 'extensions',
type: 'string',
defaultValue: 'mkv,mp4',
inputUI: {
type: 'text',
},
tooltip: 'A comma separated list of extensions to check',
},
],
outputs: [
{
number: 1,
tooltip: 'File is one of extensions',
},
{
number: 2,
tooltip: 'File is not one of extensions',
},
],
}); };
exports.details = details;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
var plugin = function (args) {
var lib = require('../../../../../methods/lib')();
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
args.inputs = lib.loadDefaultValues(args.inputs, details);
var extensions = String(args.inputs.extensions);
var extensionArray = extensions.trim().split(',');
var extension = (0, fileUtils_1.getContainer)(args.inputFileObj._id);
var extensionMatch = false;
if (extensionArray.includes(extension)) {
extensionMatch = true;
}
return {
outputFileObj: args.inputFileObj,
outputNumber: extensionMatch ? 1 : 2,
variables: args.variables,
};
};
exports.plugin = plugin;

View file

@ -0,0 +1,92 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.plugin = exports.details = void 0;
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
var details = function () { return ({
name: 'Check File Size',
description: 'Check size of working file',
style: {
borderColor: 'orange',
},
tags: 'video',
isStartPlugin: false,
sidebarPosition: -1,
icon: 'faQuestion',
inputs: [
{
name: 'unit',
type: 'string',
defaultValue: 'GB',
inputUI: {
type: 'dropdown',
options: [
'B',
'KB',
'MB',
'GB',
],
},
tooltip: 'Specify the unit to use',
},
{
name: 'greaterThan',
type: 'number',
defaultValue: '0',
inputUI: {
type: 'text',
},
tooltip: 'Specify lower bound',
},
{
name: 'lessThan',
type: 'number',
defaultValue: '10000',
inputUI: {
type: 'text',
},
tooltip: 'Specify upper bound',
},
],
outputs: [
{
number: 1,
tooltip: 'File within range',
},
{
number: 2,
tooltip: 'File not within range',
},
],
}); };
exports.details = details;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
var plugin = function (args) {
var lib = require('../../../../../methods/lib')();
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
args.inputs = lib.loadDefaultValues(args.inputs, details);
var isWithinRange = false;
var greaterThanBytes = Number(args.inputs.greaterThan);
var lessThanBytes = Number(args.inputs.lessThan);
var fileSizeBytes = args.inputFileObj.file_size * 1000 * 1000;
if (args.inputs.unit === 'KB') {
greaterThanBytes *= 1000;
lessThanBytes *= 1000;
}
else if (args.inputs.unit === 'MB') {
greaterThanBytes *= 1000000;
lessThanBytes *= 1000000;
}
else if (args.inputs.unit === 'GB') {
greaterThanBytes *= 1000000000;
lessThanBytes *= 1000000000;
}
if (fileSizeBytes >= greaterThanBytes && fileSizeBytes <= lessThanBytes) {
isWithinRange = true;
}
return {
outputFileObj: args.inputFileObj,
outputNumber: isWithinRange ? 1 : 2,
variables: args.variables,
};
};
exports.plugin = plugin;

View file

@ -0,0 +1,53 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.plugin = exports.details = void 0;
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
var details = function () { return ({
name: 'Compare File Size',
description: 'Compare file size of working file compared to original file',
style: {
borderColor: 'orange',
},
tags: '',
isStartPlugin: false,
sidebarPosition: -1,
icon: 'faQuestion',
inputs: [],
outputs: [
{
number: 1,
tooltip: 'Working file is smaller than original file',
},
{
number: 2,
tooltip: 'Working file is same size as original file',
},
{
number: 3,
tooltip: 'Working file is larger than original file',
},
],
}); };
exports.details = details;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
var plugin = function (args) {
var lib = require('../../../../../methods/lib')();
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
args.inputs = lib.loadDefaultValues(args.inputs, details);
var outputNumber = 1;
if (args.inputFileObj.file_size < args.originalLibraryFile.file_size) {
outputNumber = 1;
}
else if (args.inputFileObj.file_size === args.originalLibraryFile.file_size) {
outputNumber = 2;
}
else if (args.inputFileObj.file_size > args.originalLibraryFile.file_size) {
outputNumber = 3;
}
return {
outputFileObj: args.inputFileObj,
outputNumber: outputNumber,
variables: args.variables,
};
};
exports.plugin = plugin;

View file

@ -1,13 +1,50 @@
"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 });
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 }] */
var details = function () { return ({
name: 'Copy to Directory',
description: 'Copy the working file to a directory',
style: {
borderColor: 'green',
opacity: 0.5,
},
tags: '',
isStartPlugin: false,
@ -15,19 +52,26 @@ var details = function () { return ({
icon: 'faArrowRight',
inputs: [
{
name: 'target_codec',
name: 'outputDirectory',
type: 'string',
defaultValue: 'hevc',
defaultValue: '',
inputUI: {
type: 'dropdown',
type: 'text',
},
tooltip: 'Specify ouput directory',
},
{
name: 'makeWorkingFile',
type: 'boolean',
defaultValue: 'false',
inputUI: {
type: 'text',
options: [
'hevc',
// 'vp9',
'h264',
// 'vp8',
'false',
'true',
],
},
tooltip: 'Specify the codec to use',
tooltip: 'Make the copied file the working file',
},
],
outputs: [
@ -39,14 +83,32 @@ var details = function () { return ({
}); };
exports.details = details;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
var plugin = function (args) {
var lib = require('../../../../../methods/lib')();
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
args.inputs = lib.loadDefaultValues(args.inputs, details);
return {
outputFileObj: args.inputFileObj,
outputNumber: 1,
variables: args.variables,
};
};
var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function () {
var lib, originalFileName, newContainer, outputPath, workingFile;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
lib = require('../../../../../methods/lib')();
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
args.inputs = lib.loadDefaultValues(args.inputs, details);
originalFileName = (0, fileUtils_1.getFileName)(args.originalLibraryFile._id);
newContainer = (0, fileUtils_1.getContainer)(args.inputFileObj._id);
outputPath = "".concat(args.inputs.outputDirectory, "/").concat(originalFileName, ".").concat(newContainer);
return [4 /*yield*/, fs_1.promises.copyFile(args.inputFileObj._id, outputPath)];
case 1:
_a.sent();
workingFile = args.inputFileObj._id;
if (args.inputs.makeWorkingFile) {
workingFile = outputPath;
}
return [2 /*return*/, {
outputFileObj: {
_id: workingFile,
},
outputNumber: 1,
variables: args.variables,
}];
}
});
}); };
exports.plugin = plugin;

View file

@ -7,6 +7,7 @@ var details = function () { return ({
description: 'Move working file to directory.',
style: {
borderColor: 'green',
opacity: 0.5,
},
tags: '',
isStartPlugin: false,

View file

@ -1,19 +1,66 @@
"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 });
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 }] */
var details = function () { return ({
name: 'Move To Directory',
description: 'Move working file to directory.',
style: {
borderColor: 'green',
opacity: 0.5,
},
tags: '',
isStartPlugin: false,
sidebarPosition: -1,
icon: 'faArrowRight',
inputs: [],
inputs: [
{
name: 'outputDirectory',
type: 'string',
defaultValue: '',
inputUI: {
type: 'text',
},
tooltip: 'Specify ouput directory',
},
],
outputs: [
{
number: 1,
@ -23,14 +70,28 @@ var details = function () { return ({
}); };
exports.details = details;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
var plugin = function (args) {
var lib = require('../../../../../methods/lib')();
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
args.inputs = lib.loadDefaultValues(args.inputs, details);
return {
outputFileObj: args.inputFileObj,
outputNumber: 1,
variables: args.variables,
};
};
var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function () {
var lib, originalFileName, newContainer, outputPath;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
lib = require('../../../../../methods/lib')();
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
args.inputs = lib.loadDefaultValues(args.inputs, details);
originalFileName = (0, fileUtils_1.getFileName)(args.originalLibraryFile._id);
newContainer = (0, fileUtils_1.getContainer)(args.inputFileObj._id);
outputPath = "".concat(args.inputs.outputDirectory, "/").concat(originalFileName, ".").concat(newContainer);
return [4 /*yield*/, fs_1.promises.rename(args.inputFileObj._id, outputPath)];
case 1:
_a.sent();
return [2 /*return*/, {
outputFileObj: {
_id: outputPath,
},
outputNumber: 1,
variables: args.variables,
}];
}
});
}); };
exports.plugin = plugin;

View file

@ -40,7 +40,7 @@ exports.plugin = exports.details = void 0;
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
var details = function () { return ({
name: 'Replace Original File',
description: 'Replace the origial file',
description: 'Replace the original file',
style: {
borderColor: 'green',
},
@ -48,23 +48,7 @@ var details = function () { return ({
isStartPlugin: false,
sidebarPosition: -1,
icon: 'faArrowRight',
inputs: [
{
name: 'target_codec',
type: 'string',
defaultValue: 'hevc',
inputUI: {
type: 'dropdown',
options: [
'hevc',
// 'vp9',
'h264',
// 'vp8',
],
},
tooltip: 'Specify the codec to use',
},
],
inputs: [],
outputs: [
{
number: 1,

View file

@ -0,0 +1,37 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.plugin = exports.details = void 0;
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
var details = function () { return ({
name: 'Set Original File',
description: 'Set the working file to the original file',
style: {
borderColor: 'green',
},
tags: '',
isStartPlugin: false,
sidebarPosition: -1,
icon: '',
inputs: [],
outputs: [
{
number: 1,
tooltip: 'Continue to next plugin',
},
],
}); };
exports.details = details;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
var plugin = function (args) {
var lib = require('../../../../../methods/lib')();
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
args.inputs = lib.loadDefaultValues(args.inputs, details);
return {
outputFileObj: {
_id: args.originalLibraryFile._id,
},
outputNumber: 1,
variables: args.variables,
};
};
exports.plugin = plugin;

View file

@ -0,0 +1,36 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.plugin = exports.details = void 0;
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
var details = function () { return ({
name: 'Unpack File',
description: 'Unpack a file',
style: {
borderColor: 'green',
opacity: 0.5,
},
tags: '',
isStartPlugin: false,
sidebarPosition: -1,
icon: 'faArrowRight',
inputs: [],
outputs: [
{
number: 1,
tooltip: 'Continue to next plugin',
},
],
}); };
exports.details = details;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
var plugin = function (args) {
var lib = require('../../../../../methods/lib')();
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
args.inputs = lib.loadDefaultValues(args.inputs, details);
return {
outputFileObj: args.inputFileObj,
outputNumber: 1,
variables: args.variables,
};
};
exports.plugin = plugin;