🅿️ Paginating covers response
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
"clooney": "^0.6.6",
|
||||
"comlink-loader": "^2.0.0",
|
||||
"express": "^4.17.1",
|
||||
"express-paginate": "^1.0.2",
|
||||
"fs-extra": "^9.1.0",
|
||||
"imghash": "^0.0.8",
|
||||
"mongoose": "^5.10.11",
|
||||
|
||||
@@ -12,8 +12,8 @@ export const greet = async (
|
||||
console.log(path);
|
||||
const targetOptions = {
|
||||
sourceFolder: path,
|
||||
extractTarget: "cover",
|
||||
targetExtractionFolder: "./userdata/covers",
|
||||
extractTarget: "all",
|
||||
targetExtractionFolder: "./userdata/expanded",
|
||||
};
|
||||
const fileObjects = await walkFolder("./comics");
|
||||
_.map(fileObjects, async (fileObject) => {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import express, { Request, Response, Router, Express } from "express";
|
||||
import bodyParser from "body-parser";
|
||||
import router from "./route";
|
||||
import { default as paginate } from "express-paginate";
|
||||
|
||||
// call express
|
||||
const app: Express = express(); // define our app using express
|
||||
@@ -8,6 +9,7 @@ const app: Express = express(); // define our app using express
|
||||
// configure app to use bodyParser for
|
||||
// Getting data from body of requests
|
||||
app.use(bodyParser.json());
|
||||
app.use(paginate.middleware(10, 50));
|
||||
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import router from "../router";
|
||||
import { default as paginate } from "express-paginate";
|
||||
import {
|
||||
walkFolder,
|
||||
extractArchive,
|
||||
@@ -14,8 +15,9 @@ router.route("/getComicCovers").post(async (req: Request, res: Response) => {
|
||||
typeof req.body.extractionOptions === "object"
|
||||
? req.body.extractionOptions
|
||||
: {};
|
||||
console.log(req.body)
|
||||
const extractedData = await extractArchive(req.body);
|
||||
console.log(extractedData);
|
||||
// const pageCount = Math.ceil( / req.body.paginationOptions.pageLimit);
|
||||
// const foo = await extractMetadataFromImage(
|
||||
// "./comics/covers/Ghosts and Ruins-001.jpg",
|
||||
// );
|
||||
|
||||
@@ -63,12 +63,12 @@ export const unrar = async (
|
||||
paths.targetPath + "/" + fileName,
|
||||
fileArrayBuffer,
|
||||
);
|
||||
resolve({
|
||||
name: `${fileName}`,
|
||||
path: paths.targetPath,
|
||||
fileSize: fileHeader.packSize,
|
||||
});
|
||||
}
|
||||
resolve({
|
||||
name: `${fileHeader.name}`,
|
||||
path: paths.targetPath,
|
||||
fileSize: fileHeader.packSize,
|
||||
});
|
||||
});
|
||||
} catch (error) {
|
||||
logger.error(`${error}: Couldn't write file.`);
|
||||
|
||||
27
yarn.lock
27
yarn.lock
@@ -5061,6 +5061,16 @@ expect@^26.6.2:
|
||||
jest-message-util "^26.6.2"
|
||||
jest-regex-util "^26.0.0"
|
||||
|
||||
express-paginate@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/express-paginate/-/express-paginate-1.0.2.tgz#7d5c0214fe713aef1685daf7ada3ec5203ae1e2e"
|
||||
integrity sha512-z0VTaLrsMe4PJFifjJCC4Q11cwrveSOejicYOgFi6RzqUMPd8kIlK95x/xq6g6k6urCI2Fd3gadj3AZ9AGqguw==
|
||||
dependencies:
|
||||
lodash.assign "^4.2.0"
|
||||
lodash.clone "^4.5.0"
|
||||
lodash.isobject "^3.0.2"
|
||||
qs "^6.5.1"
|
||||
|
||||
express@^4.17.1:
|
||||
version "4.17.1"
|
||||
resolved "https://registry.yarnpkg.com/express/-/express-4.17.1.tgz#4491fc38605cf51f8629d39c2b5d026f98a4c134"
|
||||
@@ -7826,6 +7836,16 @@ locate-path@^5.0.0:
|
||||
dependencies:
|
||||
p-locate "^4.1.0"
|
||||
|
||||
lodash.assign@^4.2.0:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7"
|
||||
integrity sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=
|
||||
|
||||
lodash.clone@^4.5.0:
|
||||
version "4.5.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.clone/-/lodash.clone-4.5.0.tgz#195870450f5a13192478df4bc3d23d2dea1907b6"
|
||||
integrity sha1-GVhwRQ9aExkkeN9Lw9I9LeoZB7Y=
|
||||
|
||||
lodash.debounce@^4.0.8:
|
||||
version "4.0.8"
|
||||
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
|
||||
@@ -7836,6 +7856,11 @@ lodash.isequalwith@^4.4.0:
|
||||
resolved "https://registry.yarnpkg.com/lodash.isequalwith/-/lodash.isequalwith-4.4.0.tgz#266726ddd528f854f21f4ea98a065606e0fbc6b0"
|
||||
integrity sha1-Jmcm3dUo+FTyH06pigZWBuD7xrA=
|
||||
|
||||
lodash.isobject@^3.0.2:
|
||||
version "3.0.2"
|
||||
resolved "https://registry.yarnpkg.com/lodash.isobject/-/lodash.isobject-3.0.2.tgz#3c8fb8d5b5bf4bf90ae06e14f2a530a4ed935e1d"
|
||||
integrity sha1-PI+41bW/S/kK4G4U8qUwpO2TXh0=
|
||||
|
||||
lodash@^4.0.0, lodash@^4.17.21, lodash@^4.17.5, lodash@^4.7.0, lodash@~4.17.10:
|
||||
version "4.17.21"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
|
||||
@@ -9795,7 +9820,7 @@ qs@6.7.0:
|
||||
resolved "https://registry.yarnpkg.com/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc"
|
||||
integrity sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==
|
||||
|
||||
qs@^6.10.1:
|
||||
qs@^6.10.1, qs@^6.5.1:
|
||||
version "6.10.1"
|
||||
resolved "https://registry.yarnpkg.com/qs/-/qs-6.10.1.tgz#4931482fa8d647a5aab799c5271d2133b981fb6a"
|
||||
integrity sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==
|
||||
|
||||
Reference in New Issue
Block a user