mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-16 10:45:53 -07:00
Force rename with radarr/sonarr : corrected mistake
This commit is contained in:
parent
4be4bc7169
commit
06e1213c71
2 changed files with 8 additions and 8 deletions
|
|
@ -113,7 +113,7 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
|
||||||
'X-Api-Key': arr_api_key,
|
'X-Api-Key': arr_api_key,
|
||||||
Accept: 'application/json',
|
Accept: 'application/json',
|
||||||
};
|
};
|
||||||
rename = function (getId, getPreviewRenameResquestUrl, getRenameResquestData) { return __awaiter(void 0, void 0, void 0, function () {
|
rename = function (getId, getPreviewRenameResquestUrl, getRenameResquestConfigData) { return __awaiter(void 0, void 0, void 0, function () {
|
||||||
var parseRequestConfig, parseRequestResult, id, previewRenameRequestConfig, previewRenameRequestResult, renameRequestConfig;
|
var parseRequestConfig, parseRequestResult, id, previewRenameRequestConfig, previewRenameRequestResult, renameRequestConfig;
|
||||||
return __generator(this, function (_a) {
|
return __generator(this, function (_a) {
|
||||||
switch (_a.label) {
|
switch (_a.label) {
|
||||||
|
|
@ -141,7 +141,7 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
|
||||||
method: 'post',
|
method: 'post',
|
||||||
url: "".concat(arrHost, "/api/v3/command"),
|
url: "".concat(arrHost, "/api/v3/command"),
|
||||||
headers: headers,
|
headers: headers,
|
||||||
data: JSON.stringify(getRenameResquestData(id, previewRenameRequestResult))
|
data: JSON.stringify(getRenameResquestConfigData(id, previewRenameRequestResult))
|
||||||
};
|
};
|
||||||
return [4 /*yield*/, args.deps.axios(renameRequestConfig)];
|
return [4 /*yield*/, args.deps.axios(renameRequestConfig)];
|
||||||
case 3:
|
case 3:
|
||||||
|
|
@ -172,7 +172,7 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
|
||||||
episodeNumber_1 = parseRequestResult.data.parsedEpisodeInfo.episodeNumbers[0];
|
episodeNumber_1 = parseRequestResult.data.parsedEpisodeInfo.episodeNumbers[0];
|
||||||
return "".concat(arrHost, "/api/v3/rename?seriesId=").concat(id, "&seasonNumber=").concat(parseRequestResult.data.parsedEpisodeInfo.seasonNumber);
|
return "".concat(arrHost, "/api/v3/rename?seriesId=").concat(id, "&seasonNumber=").concat(parseRequestResult.data.parsedEpisodeInfo.seasonNumber);
|
||||||
}, function (id, previewRenameRequestResult) {
|
}, function (id, previewRenameRequestResult) {
|
||||||
var episodeFile = previewRenameRequestResult.find(function (episFile) { return episFile.episodeNumbers[0] === episodeNumber_1; });
|
var episodeFile = previewRenameRequestResult.data.find(function (episFile) { return episFile.episodeNumbers[0] === episodeNumber_1; });
|
||||||
(existingPath = episodeFile.existingPath, newPath = episodeFile.newPath);
|
(existingPath = episodeFile.existingPath, newPath = episodeFile.newPath);
|
||||||
return {
|
return {
|
||||||
name: 'RenameFiles',
|
name: 'RenameFiles',
|
||||||
|
|
@ -188,7 +188,7 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
|
||||||
_d.label = 5;
|
_d.label = 5;
|
||||||
case 5:
|
case 5:
|
||||||
newFileId = args.inputFileObj.replace(existingPath, newPath);
|
newFileId = args.inputFileObj.replace(existingPath, newPath);
|
||||||
args.jobLog("New file iid ".concat(newFileId));
|
args.jobLog("New file id ".concat(newFileId));
|
||||||
return [2 /*return*/, {
|
return [2 /*return*/, {
|
||||||
outputFileObj: {
|
outputFileObj: {
|
||||||
_id: newFileId
|
_id: newFileId
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ const plugin = async (args: IpluginInputArgs): Promise<IpluginOutputArgs> => {
|
||||||
const rename = async (
|
const rename = async (
|
||||||
getId: (parseRequestResult: any) => any,
|
getId: (parseRequestResult: any) => any,
|
||||||
getPreviewRenameResquestUrl: (id: any, parseRequestResult: any) => any,
|
getPreviewRenameResquestUrl: (id: any, parseRequestResult: any) => any,
|
||||||
getRenameResquestData: (id: any, previewRenameRequestResult: any) => any)
|
getRenameResquestConfigData: (id: any, previewRenameRequestResult: any) => any)
|
||||||
: Promise<void> => {
|
: Promise<void> => {
|
||||||
args.jobLog('Going to force rename');
|
args.jobLog('Going to force rename');
|
||||||
|
|
||||||
|
|
@ -111,7 +111,7 @@ const plugin = async (args: IpluginInputArgs): Promise<IpluginOutputArgs> => {
|
||||||
method: 'post',
|
method: 'post',
|
||||||
url: `${arrHost}/api/v3/command`,
|
url: `${arrHost}/api/v3/command`,
|
||||||
headers,
|
headers,
|
||||||
data: JSON.stringify(getRenameResquestData(id, previewRenameRequestResult))
|
data: JSON.stringify(getRenameResquestConfigData(id, previewRenameRequestResult))
|
||||||
};
|
};
|
||||||
await args.deps.axios(renameRequestConfig);
|
await args.deps.axios(renameRequestConfig);
|
||||||
|
|
||||||
|
|
@ -142,7 +142,7 @@ const plugin = async (args: IpluginInputArgs): Promise<IpluginOutputArgs> => {
|
||||||
return `${arrHost}/api/v3/rename?seriesId=${id}&seasonNumber=${parseRequestResult.data.parsedEpisodeInfo.seasonNumber}`;
|
return `${arrHost}/api/v3/rename?seriesId=${id}&seasonNumber=${parseRequestResult.data.parsedEpisodeInfo.seasonNumber}`;
|
||||||
},
|
},
|
||||||
(id, previewRenameRequestResult) => {
|
(id, previewRenameRequestResult) => {
|
||||||
const episodeFile = previewRenameRequestResult.find((episFile: { episodeNumbers: number[]; }) => episFile.episodeNumbers[0] === episodeNumber);
|
const episodeFile = previewRenameRequestResult.data.find((episFile: { episodeNumbers: number[]; }) => episFile.episodeNumbers[0] === episodeNumber);
|
||||||
({ existingPath, newPath } = episodeFile);
|
({ existingPath, newPath } = episodeFile);
|
||||||
return {
|
return {
|
||||||
name: 'RenameFiles',
|
name: 'RenameFiles',
|
||||||
|
|
@ -156,7 +156,7 @@ const plugin = async (args: IpluginInputArgs): Promise<IpluginOutputArgs> => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const newFileId = args.inputFileObj.replace(existingPath, newPath);
|
const newFileId = args.inputFileObj.replace(existingPath, newPath);
|
||||||
args.jobLog(`New file iid ${newFileId}`);
|
args.jobLog(`New file id ${newFileId}`);
|
||||||
return {
|
return {
|
||||||
outputFileObj: {
|
outputFileObj: {
|
||||||
_id: newFileId
|
_id: newFileId
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue