🪛 Fixes to the wiring between extract archive and UI
This commit is contained in:
@@ -9,18 +9,23 @@ import _ from "lodash";
|
|||||||
export const greet = async (
|
export const greet = async (
|
||||||
path: string,
|
path: string,
|
||||||
): Promise<IExtractedComicBookCoverFile[] | unknown> => {
|
): Promise<IExtractedComicBookCoverFile[] | unknown> => {
|
||||||
console.log(path);
|
|
||||||
const targetOptions = {
|
const targetOptions = {
|
||||||
sourceFolder: path,
|
sourceFolder: path,
|
||||||
extractTarget: "all",
|
extractTarget: "all",
|
||||||
targetExtractionFolder: "./userdata/expanded",
|
targetExtractionFolder: "./userdata/expanded",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const pagingConfig = {
|
||||||
|
pageLimit: 25,
|
||||||
|
page: 1,
|
||||||
|
};
|
||||||
|
|
||||||
const fileObjects = await walkFolder("./comics");
|
const fileObjects = await walkFolder("./comics");
|
||||||
_.map(fileObjects, async (fileObject) => {
|
_.map(fileObjects, async (fileObject) => {
|
||||||
if (SUPPORTED_COMIC_ARCHIVES.includes(fileObject.extension)) {
|
if (SUPPORTED_COMIC_ARCHIVES.includes(fileObject.extension)) {
|
||||||
console.log({ ...targetOptions, folderDetails: fileObject });
|
|
||||||
await extractCoverFromComicBookArchive({
|
await extractCoverFromComicBookArchive({
|
||||||
...targetOptions,
|
...targetOptions,
|
||||||
|
paginationOptions: pagingConfig,
|
||||||
folderDetails: fileObject,
|
folderDetails: fileObject,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,13 @@ export interface IExtractionOptions {
|
|||||||
extractTarget: string;
|
extractTarget: string;
|
||||||
sourceFolder: string;
|
sourceFolder: string;
|
||||||
targetExtractionFolder: string;
|
targetExtractionFolder: string;
|
||||||
|
paginationOptions: IPaginationOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IPaginationOptions {
|
||||||
|
pageLimit: number;
|
||||||
|
page: number;
|
||||||
|
}
|
||||||
export interface IComicVineSearchMatch {
|
export interface IComicVineSearchMatch {
|
||||||
description: string;
|
description: string;
|
||||||
id: number;
|
id: number;
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ router.route("/getComicCovers").post(async (req: Request, res: Response) => {
|
|||||||
const pageCount = Math.ceil(
|
const pageCount = Math.ceil(
|
||||||
extractedData.length / req.body.paginationOptions.pageLimit,
|
extractedData.length / req.body.paginationOptions.pageLimit,
|
||||||
);
|
);
|
||||||
res.json({
|
|
||||||
|
return res.json({
|
||||||
object: "list",
|
object: "list",
|
||||||
has_more: paginate.hasNextPages(req)(pageCount),
|
has_more: paginate.hasNextPages(req)(pageCount),
|
||||||
pageCount,
|
pageCount,
|
||||||
@@ -40,7 +41,7 @@ router.route("/getComicCovers").post(async (req: Request, res: Response) => {
|
|||||||
// const foo = await unzipOne(options);
|
// const foo = await unzipOne(options);
|
||||||
// const foo = await unzip("asd");
|
// const foo = await unzip("asd");
|
||||||
// const foo = explodePath("Chapter Three/HELLBOY - The Chained Coffin - 069.jpg");
|
// const foo = explodePath("Chapter Three/HELLBOY - The Chained Coffin - 069.jpg");
|
||||||
res.json({
|
return res.json({
|
||||||
extractedData,
|
extractedData,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user