🐳 Workerizing
This commit is contained in:
@@ -13,16 +13,17 @@ export const greet = async (
|
|||||||
const targetOptions = {
|
const targetOptions = {
|
||||||
sourceFolder: path,
|
sourceFolder: path,
|
||||||
extractTarget: "cover",
|
extractTarget: "cover",
|
||||||
targetExtractionFolder: "../covers",
|
targetExtractionFolder: "./userdata/covers",
|
||||||
};
|
};
|
||||||
const fileObjects = await walkFolder("./comics");
|
const fileObjects = await walkFolder("./comics");
|
||||||
_.map(fileObjects, async (fileObject) => {
|
_.map(fileObjects, async (fileObject) => {
|
||||||
console.log(fileObject);
|
console.log(fileObject);
|
||||||
if (SUPPORTED_COMIC_ARCHIVES.includes(fileObject.extension)) {
|
if (SUPPORTED_COMIC_ARCHIVES.includes(fileObject.extension)) {
|
||||||
await extractCoverFromComicBookArchive({
|
console.log({ ...targetOptions, folderDetails: fileObject });
|
||||||
|
await extractCoverFromComicBookArchive({
|
||||||
...targetOptions,
|
...targetOptions,
|
||||||
folderDetails: fileObject,
|
folderDetails: fileObject,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ router.route("/getComicCovers").post(async (req: Request, res: Response) => {
|
|||||||
typeof req.body.extractionOptions === "object"
|
typeof req.body.extractionOptions === "object"
|
||||||
? req.body.extractionOptions
|
? req.body.extractionOptions
|
||||||
: {};
|
: {};
|
||||||
|
console.log(req.body)
|
||||||
const extractedData = await extractArchive(req.body.extractionOptions);
|
const extractedData = await extractArchive(req.body.extractionOptions);
|
||||||
// const foo = await extractMetadataFromImage(
|
// const foo = await extractMetadataFromImage(
|
||||||
// "./comics/covers/Ghosts and Ruins-001.jpg",
|
// "./comics/covers/Ghosts and Ruins-001.jpg",
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ export const extractArchive = async (
|
|||||||
| IExtractedComicBookCoverFile[]
|
| IExtractedComicBookCoverFile[]
|
||||||
| IExtractComicBookCoverErrorResponse
|
| IExtractComicBookCoverErrorResponse
|
||||||
> => {
|
> => {
|
||||||
|
console.log(extractionOptions);
|
||||||
switch (extractionOptions.folderDetails.extension) {
|
switch (extractionOptions.folderDetails.extension) {
|
||||||
case ".cbz":
|
case ".cbz":
|
||||||
return await unzip(extractionOptions);
|
return await unzip(extractionOptions);
|
||||||
|
|||||||
Reference in New Issue
Block a user