mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-10 07:50:29 -07:00
Add moveFileAndValidate
This commit is contained in:
parent
cf1b27c26d
commit
d7c16474cf
7 changed files with 237 additions and 18 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import { moveFileAndValidate } from '../../../../FlowHelpers/1.0.0/fileUtils';
|
||||
import {
|
||||
IpluginDetails,
|
||||
IpluginInputArgs,
|
||||
|
|
@ -72,7 +73,11 @@ const plugin = async (args: IpluginInputArgs): Promise<IpluginOutputArgs> => {
|
|||
fs.unlinkSync(newPath);
|
||||
}
|
||||
|
||||
fs.renameSync(currentPath, newPathTmp);
|
||||
await moveFileAndValidate({
|
||||
inputPath: currentPath,
|
||||
outputPath: newPathTmp,
|
||||
args,
|
||||
});
|
||||
|
||||
// delete original file
|
||||
if (fs.existsSync(args.originalLibraryFile._id)) {
|
||||
|
|
@ -80,7 +85,12 @@ const plugin = async (args: IpluginInputArgs): Promise<IpluginOutputArgs> => {
|
|||
}
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000));
|
||||
fs.renameSync(newPathTmp, newPath);
|
||||
|
||||
await moveFileAndValidate({
|
||||
inputPath: newPathTmp,
|
||||
outputPath: newPath,
|
||||
args,
|
||||
});
|
||||
|
||||
return {
|
||||
outputFileObj: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue