From 527840e3ffa0e2ea99404842ea13cea4d2232e74 Mon Sep 17 00:00:00 2001 From: Kohei Watanabe Date: Sun, 19 Nov 2023 23:03:50 +0900 Subject: [PATCH] fixed blocks --- platforms/dmm-books.ts | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/platforms/dmm-books.ts b/platforms/dmm-books.ts index 9ae8bae..6f0f1cb 100644 --- a/platforms/dmm-books.ts +++ b/platforms/dmm-books.ts @@ -42,6 +42,8 @@ async function getFiles() { const conf = content.configuration.contents[index]; const { No, + DummyWidth, + DummyHeight, Size: { Width, Height }, } = file.FileLinkInfo.PageLinkInfoList[0].Page; @@ -51,14 +53,14 @@ async function getFiles() { `${conf["original-file-path"]}#-acs-position-${file.PageToBookmark[0][0]}-${file.PageToBookmark[0][1]}`, ); - const w = [...page.url] - .map((c) => c.charCodeAt()) + const w = [...`${conf.file}/${No}`] + .map((c) => c.charCodeAt(0)) .reduce((a, cc) => a + cc, 0); const pattern = (w % NFBR.a0X.a3h) + 1; const blocks = NFBR.a3E.a3f( - Width, - Height, + Width + DummyWidth, + Height + DummyHeight, NFBR.a0X.a3g, NFBR.a0X.a3G, pattern, @@ -66,7 +68,12 @@ async function getFiles() { const url = `${a5w.url}${page.url}`; - files.push({ url, blocks, width: Width, height: Height }); + files.push({ + url, + blocks, + width: Width, + height: Height, + }); } return files; @@ -148,7 +155,7 @@ export function DmmBooks({ db, browser }: { db: Database; browser: Browser }) { const page = await ctx.newPage(); // TODO: --all - await fs.mkdir(dir); + // await fs.mkdir(dir); await page.goto(book.readerUrl); const files = await page.evaluate(getFiles);