From 5c2d2814a6e09d2752dc5663743ad9780480f052 Mon Sep 17 00:00:00 2001 From: "jeanchristophe.mqt@gmail.com" Date: Fri, 26 Jan 2024 11:00:15 +0100 Subject: [PATCH] Little more refactoring --- .../1.0.0/index.js | 4 ++-- .../1.0.0/index.ts | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/FlowPlugins/CommunityFlowPlugins/tools/applyRadarrOrSonarrNamingPolicy/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/tools/applyRadarrOrSonarrNamingPolicy/1.0.0/index.js index ad897eb..7ec5846 100644 --- a/FlowPlugins/CommunityFlowPlugins/tools/applyRadarrOrSonarrNamingPolicy/1.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/tools/applyRadarrOrSonarrNamingPolicy/1.0.0/index.js @@ -172,7 +172,7 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function _a.label = 5; case 5: return [3 /*break*/, 7]; case 6: - args.jobLog("\u2714 No ".concat(arr === 'radarr' ? 'movie' : 'serie', " with a file named '").concat(fileName, "'.")); + args.jobLog("No ".concat(arr === 'radarr' ? 'movie' : 'serie', " with a file named '").concat(fileName, "'.")); _a.label = 7; case 7: return [2 /*return*/, pathWithNewName]; } @@ -205,7 +205,7 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function getFileToRename: function (previewRenameRequestResult) { var _a, _b; return (((_b = (_a = previewRenameRequestResult.data) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0) ? - previewRenameRequestResult.data.find(function (episFile) { var _a, _b; return (((_b = (_a = episFile.episodeNumbers) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0) ? episFile.episodeNumbers[0] === episodeNumber_1 : false; }) + previewRenameRequestResult.data.find(function (episodeFile) { var _a, _b; return (((_b = (_a = episodeFile.episodeNumbers) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0) ? episodeFile.episodeNumbers[0] === episodeNumber_1 : false; }) : undefined; } })]; diff --git a/FlowPluginsTs/CommunityFlowPlugins/tools/applyRadarrOrSonarrNamingPolicy/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/tools/applyRadarrOrSonarrNamingPolicy/1.0.0/index.ts index c5cfde0..8ced451 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/tools/applyRadarrOrSonarrNamingPolicy/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/tools/applyRadarrOrSonarrNamingPolicy/1.0.0/index.ts @@ -66,6 +66,12 @@ const details = (): IpluginDetails => ({ ], }); +interface IGetNewPathDelegates { + getId: (parseRequestResult: any) => string, + getPreviewRenameResquestUrl: (id: string, parseRequestResult: any) => string, + getFileToRename: (previewRenameRequestResult: any) => any +} + const plugin = async (args: IpluginInputArgs): Promise => { const lib = require('../../../../../methods/lib')(); // eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign @@ -76,12 +82,6 @@ const plugin = async (args: IpluginInputArgs): Promise => { const arrHost = arr_host.endsWith('/') ? arr_host.slice(0, -1) : arr_host; const fileName = getFileName(args.inputFileObj._id); - interface IGetNewPathDelegates { - getId: (parseRequestResult: any) => string, - getPreviewRenameResquestUrl: (id: string, parseRequestResult: any) => string, - getFileToRename: (previewRenameRequestResult: any) => any - } - const getNewPath = async (delegates: IGetNewPathDelegates) : Promise => { let pathWithNewName = ''; @@ -130,7 +130,7 @@ const plugin = async (args: IpluginInputArgs): Promise => { } else args.jobLog('✔ No rename necessary.'); } else - args.jobLog(`✔ No ${arr === 'radarr' ? 'movie' : 'serie'} with a file named '${fileName}'.`); + args.jobLog(`No ${arr === 'radarr' ? 'movie' : 'serie'} with a file named '${fileName}'.`); return pathWithNewName; }; @@ -155,7 +155,7 @@ const plugin = async (args: IpluginInputArgs): Promise => { }, getFileToRename: (previewRenameRequestResult) => ((previewRenameRequestResult.data?.length ?? 0) > 0) ? - previewRenameRequestResult.data.find((episFile: { episodeNumbers: number[]; }) => ((episFile.episodeNumbers?.length ?? 0) > 0) ? episFile.episodeNumbers[0] === episodeNumber : false) + previewRenameRequestResult.data.find((episodeFile: { episodeNumbers: number[]; }) => ((episodeFile.episodeNumbers?.length ?? 0) > 0) ? episodeFile.episodeNumbers[0] === episodeNumber : false) : undefined }); } else {