🪚 Wiring up extractComicCover call with UI
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import axios from "axios";
|
||||
import { IFolderData } from "../shared/interfaces/comicinfo.interfaces";
|
||||
import {
|
||||
IExtractComicBookCoverErrorResponse,
|
||||
IExtractedComicBookCoverFile,
|
||||
IExtractionOptions,
|
||||
IFolderData,
|
||||
} from "../../server/interfaces/folder.interface";
|
||||
import { FS_API_BASE_URI } from "../constants/endpoints";
|
||||
|
||||
@@ -25,6 +25,7 @@ export async function walkFolder(path: string): Promise<Array<IFolderData>> {
|
||||
|
||||
export async function extractCoverFromComicBookArchive(
|
||||
options: IExtractionOptions,
|
||||
walkedFolders: Array<IFolderData>,
|
||||
): Promise<
|
||||
| IExtractedComicBookCoverFile
|
||||
| IExtractedComicBookCoverFile[]
|
||||
@@ -34,7 +35,8 @@ export async function extractCoverFromComicBookArchive(
|
||||
url: FS_API_BASE_URI + "getComicCovers",
|
||||
method: "POST",
|
||||
data: {
|
||||
...options,
|
||||
options,
|
||||
walkedFolders,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,9 +2,7 @@ import {
|
||||
walkFolder,
|
||||
extractCoverFromComicBookArchive,
|
||||
} from "../actions/fileops.actions";
|
||||
import { SUPPORTED_COMIC_ARCHIVES } from "../constants/importer.config";
|
||||
import { IExtractedComicBookCoverFile } from "../../server/interfaces/folder.interface";
|
||||
import _ from "lodash";
|
||||
|
||||
export const greet = async (
|
||||
path: string,
|
||||
@@ -13,6 +11,7 @@ export const greet = async (
|
||||
sourceFolder: path,
|
||||
extractTarget: "all",
|
||||
targetExtractionFolder: "./userdata/expanded",
|
||||
extractionMode: "bulk",
|
||||
};
|
||||
|
||||
const pagingConfig = {
|
||||
@@ -21,14 +20,11 @@ export const greet = async (
|
||||
};
|
||||
|
||||
const fileObjects = await walkFolder("./comics");
|
||||
{
|
||||
if (SUPPORTED_COMIC_ARCHIVES.includes(fileObject.extension)) {
|
||||
return await extractCoverFromComicBookArchive({
|
||||
...targetOptions,
|
||||
paginationOptions: pagingConfig,
|
||||
folderDetails: fileObject,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return await extractCoverFromComicBookArchive(
|
||||
{
|
||||
...targetOptions,
|
||||
paginationOptions: pagingConfig,
|
||||
},
|
||||
fileObjects,
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user