From a02379f2407d084f91d8c546e69011030a1b7408 Mon Sep 17 00:00:00 2001 From: "jeanchristophe.mqt@gmail.com" Date: Fri, 29 Mar 2024 11:36:35 +0100 Subject: [PATCH] Final corrections after testing --- .../tools/notifyRadarrOrSonarr/2.0.0/index.js | 14 +++++++------- .../tools/notifyRadarrOrSonarr/2.0.0/index.ts | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/FlowPlugins/CommunityFlowPlugins/tools/notifyRadarrOrSonarr/2.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/tools/notifyRadarrOrSonarr/2.0.0/index.js index 8c69472..c960a2a 100644 --- a/FlowPlugins/CommunityFlowPlugins/tools/notifyRadarrOrSonarr/2.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/tools/notifyRadarrOrSonarr/2.0.0/index.js @@ -106,9 +106,9 @@ var details = function () { return ({ exports.details = details; var getId = function (args, arr, arrHost, headers, fileName, refreshType) { return __awaiter(void 0, void 0, void 0, function () { var imdbId, id, _a, _b, _c, _d; - var _e, _f, _g, _h; - return __generator(this, function (_j) { - switch (_j.label) { + var _e, _f, _g, _h, _j; + return __generator(this, function (_k) { + switch (_k.label) { case 0: imdbId = (_f = (_e = /\b(tt|nm|co|ev|ch|ni)\d{7,10}\b/i.exec(fileName)) === null || _e === void 0 ? void 0 : _e.at(0)) !== null && _f !== void 0 ? _f : ''; if (!(imdbId !== '')) return [3 /*break*/, 2]; @@ -119,11 +119,11 @@ var getId = function (args, arr, arrHost, headers, fileName, refreshType) { retu headers: headers, })]; case 1: - _a = _b.apply(void 0, [(_h = (_g = (_j.sent()).data) === null || _g === void 0 ? void 0 : _g.id) !== null && _h !== void 0 ? _h : -1]); + _a = _b.apply(void 0, [(_j = (_h = (_g = (_k.sent()).data) === null || _g === void 0 ? void 0 : _g.at(0)) === null || _h === void 0 ? void 0 : _h.id) !== null && _j !== void 0 ? _j : -1]); return [3 /*break*/, 3]; case 2: _a = -1; - _j.label = 3; + _k.label = 3; case 3: id = _a; args.jobLog("".concat(refreshType.content, " ").concat(id !== -1 ? "".concat(id, " found") : 'not found', " for imdb '").concat(imdbId, "'")); @@ -135,9 +135,9 @@ var getId = function (args, arr, arrHost, headers, fileName, refreshType) { retu headers: headers, })]; case 4: - id = _d.apply(_c, [(_j.sent())]); + id = _d.apply(_c, [(_k.sent())]); args.jobLog("".concat(refreshType.content, " ").concat(id !== -1 ? "".concat(id, " found") : 'not found', " for '").concat((0, fileUtils_1.getFileName)(fileName), "'")); - _j.label = 5; + _k.label = 5; case 5: return [2 /*return*/, id]; } }); diff --git a/FlowPluginsTs/CommunityFlowPlugins/tools/notifyRadarrOrSonarr/2.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/tools/notifyRadarrOrSonarr/2.0.0/index.ts index 2471142..883f4e9 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/tools/notifyRadarrOrSonarr/2.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/tools/notifyRadarrOrSonarr/2.0.0/index.ts @@ -103,7 +103,7 @@ const getId = async ( method: 'get', url: `${arrHost}/api/v3/${arr === 'radarr' ? 'movie' : 'series'}/lookup?term=imdb:${imdbId}`, headers, - })).data?.id ?? -1, + })).data?.at(0)?.id ?? -1, ) : -1; args.jobLog(`${refreshType.content} ${id !== -1 ? `${id} found` : 'not found'} for imdb '${imdbId}'`);