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

@ -16,23 +16,7 @@ const details = ():IpluginDetails => ({
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,
@ -41,49 +25,14 @@ const details = ():IpluginDetails => ({
],
});
const getNewPath = (originalPath:string, tempPath:string) => {
const tempPathParts = tempPath.split('.');
const container = tempPathParts[tempPathParts.length - 1];
const originalPathParts = originalPath.split('.');
originalPathParts[originalPathParts.length - 1] = container;
return originalPathParts.join('.');
};
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const plugin = async (args:IpluginInputArgs):Promise<IpluginOutputArgs> => {
const fs = require('fs');
const plugin = (args:IpluginInputArgs):IpluginOutputArgs => {
const lib = require('../../../../../methods/lib')();
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
args.inputs = lib.loadDefaultValues(args.inputs, details);
const currentPath = args.inputFileObj._id;
const newPath = getNewPath(args.originalLibraryFile._id, currentPath);
const newPathTmp = `${newPath}.tmp`;
args.jobLog(JSON.stringify({
currentPath,
newPath,
newPathTmp,
}));
await new Promise((resolve) => setTimeout(resolve, 2000));
fs.renameSync(currentPath, newPathTmp);
if (fs.existsSync(newPath)) {
fs.unlinkSync(newPath);
}
await new Promise((resolve) => setTimeout(resolve, 2000));
fs.renameSync(newPathTmp, newPath);
return {
outputFileObj: {
_id: newPath,
},
outputFileObj: args.inputFileObj,
outputNumber: 1,
variables: args.variables,
};