mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-16 02:35:54 -07:00
Update flows
This commit is contained in:
parent
658857fdf4
commit
25c4fab8d9
73 changed files with 4295 additions and 839 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import { promises as fs } from 'fs';
|
||||
import { getContainer, getFileName } from '../../../../FlowHelpers/1.0.0/fileUtils';
|
||||
import {
|
||||
IpluginDetails,
|
||||
IpluginInputArgs,
|
||||
|
|
@ -5,12 +7,11 @@ import {
|
|||
} from '../../../../FlowHelpers/1.0.0/interfaces/interfaces';
|
||||
|
||||
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
|
||||
const details = ():IpluginDetails => ({
|
||||
const details = (): IpluginDetails => ({
|
||||
name: 'Copy to Directory',
|
||||
description: 'Copy the working file to a directory',
|
||||
style: {
|
||||
borderColor: 'green',
|
||||
opacity: 0.5,
|
||||
},
|
||||
tags: '',
|
||||
|
||||
|
|
@ -19,19 +20,26 @@ const details = ():IpluginDetails => ({
|
|||
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: [
|
||||
|
|
@ -43,13 +51,28 @@ const details = ():IpluginDetails => ({
|
|||
});
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const plugin = (args:IpluginInputArgs):IpluginOutputArgs => {
|
||||
const plugin = async (args: IpluginInputArgs): Promise<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 originalFileName = getFileName(args.originalLibraryFile._id);
|
||||
const newContainer = getContainer(args.inputFileObj._id);
|
||||
|
||||
const outputPath = `${args.inputs.outputDirectory}/${originalFileName}.${newContainer}`;
|
||||
|
||||
await fs.copyFile(args.inputFileObj._id, outputPath);
|
||||
|
||||
let workingFile = args.inputFileObj._id;
|
||||
|
||||
if (args.inputs.makeWorkingFile) {
|
||||
workingFile = outputPath;
|
||||
}
|
||||
|
||||
return {
|
||||
outputFileObj: args.inputFileObj,
|
||||
outputFileObj: {
|
||||
_id: workingFile,
|
||||
},
|
||||
outputNumber: 1,
|
||||
variables: args.variables,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue