Added the possibility to find serieId from imdbId

make-only-subtitle-default
jeanchristophe.mqt@gmail.com 2 years ago
parent b85f59da2c
commit ecb519576a

@ -116,71 +116,65 @@ var details = function () { return ({
],
}); };
exports.details = details;
var getMovieId = function (args, arrHost, headers, fileName, getNewPathType) { return __awaiter(void 0, void 0, void 0, function () {
var imdbId, id, _a, _b;
var _c, _d, _e, _f, _g;
return __generator(this, function (_h) {
switch (_h.label) {
var getFileInfoFromLookup = function (args, arr, arrHost, headers, fileName, renameType) { return __awaiter(void 0, void 0, void 0, function () {
var fInfo, imdbId, lookupResponse;
var _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
imdbId = (_d = (_c = /\b(tt|nm|co|ev|ch|ni)\d{7,10}\b/i.exec(fileName)) === null || _c === void 0 ? void 0 : _c.at(0)) !== null && _d !== void 0 ? _d : '';
fInfo = { id: '-1' };
imdbId = (_b = (_a = /\b(tt|nm|co|ev|ch|ni)\d{7,10}\b/i.exec(fileName)) === null || _a === void 0 ? void 0 : _a.at(0)) !== null && _b !== void 0 ? _b : '';
if (!(imdbId !== '')) return [3 /*break*/, 2];
_b = String;
return [4 /*yield*/, args.deps.axios({
method: 'get',
url: "".concat(arrHost, "/api/v3/movie/lookup?term=imdb:").concat(imdbId),
url: "".concat(arrHost, "/api/v3/").concat(arr === 'radarr' ? 'movie' : 'series', "/lookup?term=imdb:").concat(imdbId),
headers: headers,
})];
case 1:
_a = _b.apply(void 0, [(_g = (_f = (_e = (_h.sent()).data) === null || _e === void 0 ? void 0 : _e.at(0)) === null || _f === void 0 ? void 0 : _f.id) !== null && _g !== void 0 ? _g : -1]);
return [3 /*break*/, 3];
case 2:
_a = '-1';
_h.label = 3;
case 3:
id = _a;
args.jobLog("".concat(getNewPathType.content, " ").concat(id !== '-1' ? "".concat(id, " found") : 'not found', " for imdb '").concat(imdbId, "'"));
return [2 /*return*/, id];
lookupResponse = _c.sent();
fInfo = renameType.delegates.getFileInfoFromLookupResponse(lookupResponse, fileName);
args.jobLog("".concat(renameType.content, " ").concat(fInfo.id !== '-1' ? "'".concat(fInfo.id, "' found") : 'not found')
+ " for imdb '".concat(imdbId, "'"));
_c.label = 2;
case 2: return [2 /*return*/, fInfo];
}
});
}); };
var getFileDetailsWrapper = function (args, arr, arrHost, headers, fileName, renameType) { return __awaiter(void 0, void 0, void 0, function () {
var fdw, _a, _b;
var _c;
return __generator(this, function (_d) {
switch (_d.label) {
var getFileInfoFromParse = function (args, arr, arrHost, headers, fileName, renameType) { return __awaiter(void 0, void 0, void 0, function () {
var fInfo, parseResponse;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_c = {};
if (!(arr === 'radarr')) return [3 /*break*/, 2];
return [4 /*yield*/, getMovieId(args, arrHost, headers, fileName, renameType)];
case 1:
_a = _d.sent();
return [3 /*break*/, 3];
case 2:
_a = '-1';
_d.label = 3;
case 3:
fdw = (_c.id = _a,
_c.fileDetails = undefined,
_c);
if (!(fdw.id === '-1')) return [3 /*break*/, 5];
_b = fdw;
fInfo = { id: '-1' };
return [4 /*yield*/, args.deps.axios({
method: 'get',
url: "".concat(arrHost, "/api/v3/parse?title=").concat(encodeURIComponent((0, fileUtils_1.getFileName)(fileName))),
headers: headers,
})];
case 4:
_b.fileDetails = _d.sent();
fdw.id = renameType.delegates.getIdFromParseResponse(fdw);
args.jobLog("".concat(renameType.content, " ").concat(fdw.id !== '-1' ? "".concat(fdw.id, " found") : 'not found', " for '")
+ "".concat((0, fileUtils_1.getFileName)(fileName), "'"));
_d.label = 5;
case 5: return [2 /*return*/, fdw];
case 1:
parseResponse = _a.sent();
fInfo = renameType.delegates.getFileInfoFromParseResponse(parseResponse);
args.jobLog("".concat(renameType.content, " ").concat(fInfo.id !== '-1' ? "'".concat(fInfo.id, "' found") : 'not found')
+ " for '".concat((0, fileUtils_1.getFileName)(fileName), "'"));
return [2 /*return*/, fInfo];
}
});
}); };
var getFileInfo = function (args, arr, arrHost, headers, fileName, renameType) { return __awaiter(void 0, void 0, void 0, function () {
var fInfo;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, getFileInfoFromLookup(args, arr, arrHost, headers, fileName, renameType)];
case 1:
fInfo = _a.sent();
return [2 /*return*/, (fInfo.id === '-1' || (arr === 'sonarr' && (fInfo.seasonNumber === -1 || fInfo.episodeNumber === -1)))
? getFileInfoFromParse(args, arr, arrHost, headers, fileName, renameType)
: fInfo];
}
});
}); };
var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function () {
var lib, newPath, isSuccessful, arr, arr_host, arrHost, originalFileName, currentFileName, headers, episodeNumber, renameType, fileDetailsWrapper, previewRenameRequestResult, fileToRename;
var lib, newPath, isSuccessful, arr, arr_host, arrHost, originalFileName, currentFileName, headers, renameType, fInfo, previewRenameRequestResult, fileToRename;
var _a, _b, _c, _d;
return __generator(this, function (_e) {
switch (_e.label) {
@ -200,14 +194,14 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
'X-Api-Key': String(args.inputs.arr_api_key),
Accept: 'application/json',
};
episodeNumber = 0;
renameType = arr === 'radarr'
? {
appName: 'Radarr',
content: 'Movie',
delegates: {
getIdFromParseResponse: function (fileDetailsWrapper) { var _a, _b, _c, _d; return String((_d = (_c = (_b = (_a = fileDetailsWrapper.fileDetails) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.movie) === null || _c === void 0 ? void 0 : _c.id) !== null && _d !== void 0 ? _d : -1); },
buildPreviewRenameResquestUrl: function (fileDetailsWrapper) { return "".concat(arrHost, "/api/v3/rename?movieId=").concat(fileDetailsWrapper.id); },
getFileInfoFromLookupResponse: function (lookupResponse) { var _a, _b, _c; return ({ id: String((_c = (_b = (_a = lookupResponse === null || lookupResponse === void 0 ? void 0 : lookupResponse.data) === null || _a === void 0 ? void 0 : _a.at(0)) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : -1) }); },
getFileInfoFromParseResponse: function (parseResponse) { var _a, _b, _c; return ({ id: String((_c = (_b = (_a = parseResponse === null || parseResponse === void 0 ? void 0 : parseResponse.data) === null || _a === void 0 ? void 0 : _a.movie) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : -1) }); },
buildPreviewRenameResquestUrl: function (fInfo) { return "".concat(arrHost, "/api/v3/rename?movieId=").concat(fInfo.id); },
getFileToRenameFromPreviewRenameResponse: function (previewRenameResponse) { var _a; return (_a = previewRenameResponse.data) === null || _a === void 0 ? void 0 : _a.at(0); },
},
}
@ -215,40 +209,54 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
appName: 'Sonarr',
content: 'Serie',
delegates: {
getIdFromParseResponse: function (fileDetailsWrapper) { var _a, _b, _c, _d; return String((_d = (_c = (_b = (_a = fileDetailsWrapper.fileDetails) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.series) === null || _c === void 0 ? void 0 : _c.id) !== null && _d !== void 0 ? _d : -1); },
buildPreviewRenameResquestUrl: function (fileDetailsWrapper) {
var _a, _b, _c, _d, _e, _f;
episodeNumber = ((_c = (_b = (_a = fileDetailsWrapper.fileDetails) === null || _a === void 0 ? void 0 : _a.data.parsedEpisodeInfo) === null || _b === void 0 ? void 0 : _b.episodeNumbers) !== null && _c !== void 0 ? _c : [1])[0];
return "".concat(arrHost, "/api/v3/rename?seriesId=").concat(fileDetailsWrapper.id, "&seasonNumber=")
+ "".concat((_f = (_e = (_d = fileDetailsWrapper.fileDetails) === null || _d === void 0 ? void 0 : _d.data.parsedEpisodeInfo) === null || _e === void 0 ? void 0 : _e.seasonNumber) !== null && _f !== void 0 ? _f : 1);
getFileInfoFromLookupResponse: function (lookupResponse, fileName) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
var fInfo = { id: String((_c = (_b = (_a = lookupResponse === null || lookupResponse === void 0 ? void 0 : lookupResponse.data) === null || _a === void 0 ? void 0 : _a.at(0)) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : -1) };
if (fInfo.id !== '-1') {
var seasonEpisodenumber = (_e = (_d = /\bS\d{1,3}E\d{1,4}\b/i.exec(fileName)) === null || _d === void 0 ? void 0 : _d.at(0)) !== null && _e !== void 0 ? _e : '';
var episodeNumber = (_g = (_f = /\d{1,4}$/i.exec(seasonEpisodenumber)) === null || _f === void 0 ? void 0 : _f.at(0)) !== null && _g !== void 0 ? _g : '';
fInfo.seasonNumber = Number((_j = (_h = /\d{1,3}/i
.exec(seasonEpisodenumber.slice(0, -episodeNumber.length))) === null || _h === void 0 ? void 0 : _h.at(0)) !== null && _j !== void 0 ? _j : '-1');
fInfo.episodeNumber = Number(episodeNumber !== '' ? episodeNumber : -1);
}
return fInfo;
},
getFileInfoFromParseResponse: function (parseResponse) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
return ({
id: String((_c = (_b = (_a = parseResponse === null || parseResponse === void 0 ? void 0 : parseResponse.data) === null || _a === void 0 ? void 0 : _a.series) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : -1),
seasonNumber: (_f = (_e = (_d = parseResponse === null || parseResponse === void 0 ? void 0 : parseResponse.data) === null || _d === void 0 ? void 0 : _d.parsedEpisodeInfo) === null || _e === void 0 ? void 0 : _e.seasonNumber) !== null && _f !== void 0 ? _f : 1,
episodeNumber: (_k = (_j = (_h = (_g = parseResponse === null || parseResponse === void 0 ? void 0 : parseResponse.data) === null || _g === void 0 ? void 0 : _g.parsedEpisodeInfo) === null || _h === void 0 ? void 0 : _h.episodeNumbers) === null || _j === void 0 ? void 0 : _j.at(0)) !== null && _k !== void 0 ? _k : 1,
});
},
getFileToRenameFromPreviewRenameResponse: function (previewRenameResponse) {
buildPreviewRenameResquestUrl: function (fInfo) { return "".concat(arrHost, "/api/v3/rename?seriesId=").concat(fInfo.id, "&seasonNumber=").concat(fInfo.seasonNumber); },
getFileToRenameFromPreviewRenameResponse: function (previewRenameResponse, fInfo) {
var _a;
return (_a = previewRenameResponse.data) === null || _a === void 0 ? void 0 : _a.find(function (episodeFile) { var _a; return ((_a = episodeFile.episodeNumbers) === null || _a === void 0 ? void 0 : _a.at(0)) === episodeNumber; });
return (_a = previewRenameResponse.data) === null || _a === void 0 ? void 0 : _a.find(function (episodeFile) { var _a; return ((_a = episodeFile.episodeNumbers) === null || _a === void 0 ? void 0 : _a.at(0)) === fInfo.episodeNumber; });
},
},
};
args.jobLog('Going to apply new name');
args.jobLog("Renaming ".concat(renameType.appName, "..."));
return [4 /*yield*/, getFileDetailsWrapper(args, arr, arrHost, headers, originalFileName, renameType)];
return [4 /*yield*/, getFileInfo(args, arr, arrHost, headers, originalFileName, renameType)];
case 1:
fileDetailsWrapper = _e.sent();
if (!(fileDetailsWrapper.id === '-1' && currentFileName !== originalFileName)) return [3 /*break*/, 3];
return [4 /*yield*/, getFileDetailsWrapper(args, arr, arrHost, headers, currentFileName, renameType)];
fInfo = _e.sent();
if (!(fInfo.id === '-1' && currentFileName !== originalFileName)) return [3 /*break*/, 3];
return [4 /*yield*/, getFileInfo(args, arr, arrHost, headers, currentFileName, renameType)];
case 2:
fileDetailsWrapper = _e.sent();
fInfo = _e.sent();
_e.label = 3;
case 3:
if (!(fileDetailsWrapper.id !== '-1')) return [3 /*break*/, 7];
if (!(fInfo.id !== '-1')) return [3 /*break*/, 7];
return [4 /*yield*/, args.deps.axios({
method: 'get',
url: renameType.delegates.buildPreviewRenameResquestUrl(fileDetailsWrapper),
url: renameType.delegates.buildPreviewRenameResquestUrl(fInfo),
headers: headers,
})];
case 4:
previewRenameRequestResult = _e.sent();
fileToRename = renameType.delegates
.getFileToRenameFromPreviewRenameResponse(previewRenameRequestResult);
.getFileToRenameFromPreviewRenameResponse(previewRenameRequestResult, fInfo);
if (!(fileToRename !== undefined)) return [3 /*break*/, 6];
newPath = "".concat((0, fileUtils_1.getFileAbosluteDir)(currentFileName), "/").concat((0, fileUtils_1.getFileName)(fileToRename.newPath), ".").concat((0, fileUtils_1.getContainer)(fileToRename.newPath));
return [4 /*yield*/, (0, fileMoveOrCopy_1.default)({
@ -259,8 +267,6 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
})];
case 5:
isSuccessful = _e.sent();
args.jobLog("\u2714 ".concat(renameType.content, " ").concat(fileDetailsWrapper.id, " renamed : ")
+ "'".concat(originalFileName, "' => '").concat(newPath, "'."));
return [3 /*break*/, 7];
case 6:
isSuccessful = true;

@ -77,7 +77,15 @@ interface IHTTPHeaders {
'X-Api-Key': string,
Accept: string,
}
interface IFileDetails {
interface IFileInfo {
id: string,
seasonNumber?: number,
episodeNumber?: number
}
interface ILookupResponse {
data: [{ id: number }],
}
interface IParseResponse {
data: {
movie?: { id: number },
series?: { id: number },
@ -87,12 +95,8 @@ interface IFileDetails {
},
},
}
interface IFileDetailsWrapper {
id: string
fileDetails?: IFileDetails
}
interface IFileToRename {
newPath: string
newPath: string,
episodeNumbers?: number[]
}
interface IPreviewRenameResponse {
@ -102,38 +106,42 @@ interface IRenameType {
appName: string,
content: string,
delegates: {
getIdFromParseResponse:
(fileDetailsWrapper: IFileDetailsWrapper) => string,
getFileInfoFromLookupResponse:
(lookupResponse: ILookupResponse, fileName: string) => IFileInfo,
getFileInfoFromParseResponse:
(parseResponse: IParseResponse) => IFileInfo,
buildPreviewRenameResquestUrl:
(fileDetailsWrapper: IFileDetailsWrapper) => string,
(fileInfo: IFileInfo) => string,
getFileToRenameFromPreviewRenameResponse:
(previewRenameResponse: IPreviewRenameResponse) => IFileToRename | undefined
(previewRenameResponse: IPreviewRenameResponse, fileInfo: IFileInfo) => IFileToRename | undefined
}
}
const getMovieId = async (
const getFileInfoFromLookup = async (
args: IpluginInputArgs,
arr: string,
arrHost: string,
headers: IHTTPHeaders,
fileName: string,
getNewPathType: IRenameType,
renameType: IRenameType,
)
: Promise<string> => {
: Promise<IFileInfo> => {
let fInfo: IFileInfo = { id: '-1' };
const imdbId = /\b(tt|nm|co|ev|ch|ni)\d{7,10}\b/i.exec(fileName)?.at(0) ?? '';
const id = (imdbId !== '')
? String(
(await args.deps.axios({
if (imdbId !== '') {
const lookupResponse: ILookupResponse = await args.deps.axios({
method: 'get',
url: `${arrHost}/api/v3/movie/lookup?term=imdb:${imdbId}`,
url: `${arrHost}/api/v3/${arr === 'radarr' ? 'movie' : 'series'}/lookup?term=imdb:${imdbId}`,
headers,
})).data?.at(0)?.id ?? -1,
)
: '-1';
args.jobLog(`${getNewPathType.content} ${id !== '-1' ? `${id} found` : 'not found'} for imdb '${imdbId}'`);
return id;
});
fInfo = renameType.delegates.getFileInfoFromLookupResponse(lookupResponse, fileName);
args.jobLog(`${renameType.content} ${fInfo.id !== '-1' ? `'${fInfo.id}' found` : 'not found'}`
+ ` for imdb '${imdbId}'`);
}
return fInfo;
};
const getFileDetailsWrapper = async (
const getFileInfoFromParse = async (
args: IpluginInputArgs,
arr: string,
arrHost: string,
@ -141,22 +149,32 @@ const getFileDetailsWrapper = async (
fileName: string,
renameType: IRenameType,
)
: Promise<IFileDetailsWrapper> => {
const fdw: IFileDetailsWrapper = {
id: arr === 'radarr' ? await getMovieId(args, arrHost, headers, fileName, renameType) : '-1',
fileDetails: undefined,
};
if (fdw.id === '-1') {
fdw.fileDetails = await args.deps.axios({
: Promise<IFileInfo> => {
let fInfo: IFileInfo = { id: '-1' };
const parseResponse: IParseResponse = await args.deps.axios({
method: 'get',
url: `${arrHost}/api/v3/parse?title=${encodeURIComponent(getFileName(fileName))}`,
headers,
});
fdw.id = renameType.delegates.getIdFromParseResponse(fdw);
args.jobLog(`${renameType.content} ${fdw.id !== '-1' ? `${fdw.id} found` : 'not found'} for '`
+ `${getFileName(fileName)}'`);
}
return fdw;
fInfo = renameType.delegates.getFileInfoFromParseResponse(parseResponse);
args.jobLog(`${renameType.content} ${fInfo.id !== '-1' ? `'${fInfo.id}' found` : 'not found'}`
+ ` for '${getFileName(fileName)}'`);
return fInfo;
};
const getFileInfo = async (
args: IpluginInputArgs,
arr: string,
arrHost: string,
headers: IHTTPHeaders,
fileName: string,
renameType: IRenameType,
)
: Promise<IFileInfo> => {
const fInfo = await getFileInfoFromLookup(args, arr, arrHost, headers, fileName, renameType);
return (fInfo.id === '-1' || (arr === 'sonarr' && (fInfo.seasonNumber === -1 || fInfo.episodeNumber === -1)))
? getFileInfoFromParse(args, arr, arrHost, headers, fileName, renameType)
: fInfo;
};
const plugin = async (args: IpluginInputArgs): Promise<IpluginOutputArgs> => {
@ -177,16 +195,17 @@ const plugin = async (args: IpluginInputArgs): Promise<IpluginOutputArgs> => {
Accept: 'application/json',
};
let episodeNumber = 0;
const renameType: IRenameType = arr === 'radarr'
? {
appName: 'Radarr',
content: 'Movie',
delegates: {
getIdFromParseResponse:
(fileDetailsWrapper) => String(fileDetailsWrapper.fileDetails?.data?.movie?.id ?? -1),
getFileInfoFromLookupResponse:
(lookupResponse) => ({ id: String(lookupResponse?.data?.at(0)?.id ?? -1) }),
getFileInfoFromParseResponse:
(parseResponse) => ({ id: String(parseResponse?.data?.movie?.id ?? -1) }),
buildPreviewRenameResquestUrl:
(fileDetailsWrapper) => `${arrHost}/api/v3/rename?movieId=${fileDetailsWrapper.id}`,
(fInfo) => `${arrHost}/api/v3/rename?movieId=${fInfo.id}`,
getFileToRenameFromPreviewRenameResponse:
(previewRenameResponse) => previewRenameResponse.data?.at(0),
},
@ -195,39 +214,53 @@ const plugin = async (args: IpluginInputArgs): Promise<IpluginOutputArgs> => {
appName: 'Sonarr',
content: 'Serie',
delegates: {
getIdFromParseResponse:
(fileDetailsWrapper) => String(fileDetailsWrapper.fileDetails?.data?.series?.id ?? -1),
buildPreviewRenameResquestUrl:
(fileDetailsWrapper) => {
[episodeNumber] = fileDetailsWrapper.fileDetails?.data.parsedEpisodeInfo?.episodeNumbers ?? [1];
return `${arrHost}/api/v3/rename?seriesId=${fileDetailsWrapper.id}&seasonNumber=`
+ `${fileDetailsWrapper.fileDetails?.data.parsedEpisodeInfo?.seasonNumber ?? 1}`;
getFileInfoFromLookupResponse:
(lookupResponse, fileName) => {
const fInfo: IFileInfo = { id: String(lookupResponse?.data?.at(0)?.id ?? -1) };
if (fInfo.id !== '-1') {
const seasonEpisodenumber = /\bS\d{1,3}E\d{1,4}\b/i.exec(fileName)?.at(0) ?? '';
const episodeNumber = /\d{1,4}$/i.exec(seasonEpisodenumber)?.at(0) ?? '';
fInfo.seasonNumber = Number(/\d{1,3}/i
.exec(seasonEpisodenumber.slice(0, -episodeNumber.length))
?.at(0) ?? '-1');
fInfo.episodeNumber = Number(episodeNumber !== '' ? episodeNumber : -1);
}
return fInfo;
},
getFileInfoFromParseResponse:
(parseResponse) => ({
id: String(parseResponse?.data?.series?.id ?? -1),
seasonNumber: parseResponse?.data?.parsedEpisodeInfo?.seasonNumber ?? 1,
episodeNumber: parseResponse?.data?.parsedEpisodeInfo?.episodeNumbers?.at(0) ?? 1,
}),
buildPreviewRenameResquestUrl:
(fInfo) => `${arrHost}/api/v3/rename?seriesId=${fInfo.id}&seasonNumber=${fInfo.seasonNumber}`,
getFileToRenameFromPreviewRenameResponse:
(previewRenameResponse) => previewRenameResponse.data
?.find((episodeFile) => episodeFile.episodeNumbers?.at(0) === episodeNumber),
(previewRenameResponse, fInfo) => previewRenameResponse.data
?.find((episodeFile) => episodeFile.episodeNumbers?.at(0) === fInfo.episodeNumber),
},
};
args.jobLog('Going to apply new name');
args.jobLog(`Renaming ${renameType.appName}...`);
let fileDetailsWrapper = await getFileDetailsWrapper(args, arr, arrHost, headers, originalFileName, renameType);
// Retrieving movie or serie id, plus season and episode number for serie
let fInfo = await getFileInfo(args, arr, arrHost, headers, originalFileName, renameType);
// Useful in some edge cases
if (fileDetailsWrapper.id === '-1' && currentFileName !== originalFileName) {
fileDetailsWrapper = await getFileDetailsWrapper(args, arr, arrHost, headers, currentFileName, renameType);
if (fInfo.id === '-1' && currentFileName !== originalFileName) {
fInfo = await getFileInfo(args, arr, arrHost, headers, currentFileName, renameType);
}
// Checking that the file has been found
if (fileDetailsWrapper.id !== '-1') {
if (fInfo.id !== '-1') {
// Using rename endpoint to get ids of all the files that need renaming
const previewRenameRequestResult = await args.deps.axios({
method: 'get',
url: renameType.delegates.buildPreviewRenameResquestUrl(fileDetailsWrapper),
url: renameType.delegates.buildPreviewRenameResquestUrl(fInfo),
headers,
});
const fileToRename = renameType.delegates
.getFileToRenameFromPreviewRenameResponse(previewRenameRequestResult);
.getFileToRenameFromPreviewRenameResponse(previewRenameRequestResult, fInfo);
// Only if there is a rename to execute
if (fileToRename !== undefined) {
@ -241,8 +274,6 @@ const plugin = async (args: IpluginInputArgs): Promise<IpluginOutputArgs> => {
destinationPath: newPath,
args,
});
args.jobLog(`${renameType.content} ${fileDetailsWrapper.id} renamed : `
+ `'${originalFileName}' => '${newPath}'.`);
} else {
isSuccessful = true;
args.jobLog('✔ No rename necessary.');

Loading…
Cancel
Save