mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-16 02:35:54 -07:00
Add new copy/move options
This commit is contained in:
parent
f410caf1ad
commit
ca8ec26b81
9 changed files with 326 additions and 33 deletions
|
|
@ -7,7 +7,22 @@ export const getFileName = (filePath: string):string => {
|
|||
const parts = filePath.split('/');
|
||||
const fileNameAndContainer = parts[parts.length - 1];
|
||||
const parts2 = fileNameAndContainer.split('.');
|
||||
return parts2[0];
|
||||
parts2.pop();
|
||||
return parts2.join('.');
|
||||
};
|
||||
|
||||
export const getFfType = (codecType:string):string => (codecType === 'video' ? 'v' : 'a');
|
||||
|
||||
export const getSubStem = ({
|
||||
inputPathStem,
|
||||
inputPath,
|
||||
}: {
|
||||
inputPathStem: string,
|
||||
inputPath: string,
|
||||
}):string => {
|
||||
const subStem = inputPath.substring(inputPathStem.length);
|
||||
const parts = subStem.split('/');
|
||||
parts.pop();
|
||||
|
||||
return parts.join('/');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { IFileObject, Istreams } from './synced/IFileObject';
|
|||
import Ijob from './synced/jobInterface';
|
||||
|
||||
export interface IpluginInputUi {
|
||||
type: 'dropdown' | 'text' | 'textarea',
|
||||
type: 'dropdown' | 'text' | 'textarea' | 'directory',
|
||||
options?: string[],
|
||||
style?:Record<string, unknown>,
|
||||
onSelect?: {
|
||||
|
|
@ -115,5 +115,7 @@ export interface IpluginInputArgs {
|
|||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
axiosMiddleware: (endpoint: string, data: Record<string, unknown>) => Promise<any>,
|
||||
requireFromString: (pluginText: string, relativePath:string) => Record<string, unknown>,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
upath:any,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
28
FlowPluginsTs/FlowHelpers/1.0.0/normJoinPath.ts
Normal file
28
FlowPluginsTs/FlowHelpers/1.0.0/normJoinPath.ts
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
const formatWindowsRootFolder = (path: string): string => {
|
||||
// Remove '.' from end of Windows root folder mapping e.g. 'E:.'
|
||||
if (
|
||||
path.length === 3
|
||||
&& path.charAt(1) === ':'
|
||||
&& path.charAt(2) === '.'
|
||||
) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
path = path.slice(0, -1);
|
||||
}
|
||||
|
||||
return path;
|
||||
};
|
||||
|
||||
const normJoinPath = ({
|
||||
upath,
|
||||
paths,
|
||||
}:{
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
upath: any,
|
||||
paths: string[]
|
||||
}):string => {
|
||||
let path = upath.joinSafe(...paths);
|
||||
path = formatWindowsRootFolder(path);
|
||||
return path;
|
||||
};
|
||||
|
||||
export default normJoinPath;
|
||||
Loading…
Add table
Add a link
Reference in a new issue