|
|
|
@ -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
|
|
|
|
|