fixed blocks

This commit is contained in:
Nebel 2023-11-19 23:03:50 +09:00
parent f242adb848
commit 527840e3ff
Signed by: nebel
GPG key ID: 79807D08C6EF6460

View file

@ -42,6 +42,8 @@ async function getFiles() {
const conf = content.configuration.contents[index]; const conf = content.configuration.contents[index];
const { const {
No, No,
DummyWidth,
DummyHeight,
Size: { Width, Height }, Size: { Width, Height },
} = file.FileLinkInfo.PageLinkInfoList[0].Page; } = 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]}`, `${conf["original-file-path"]}#-acs-position-${file.PageToBookmark[0][0]}-${file.PageToBookmark[0][1]}`,
); );
const w = [...page.url] const w = [...`${conf.file}/${No}`]
.map((c) => c.charCodeAt()) .map((c) => c.charCodeAt(0))
.reduce((a, cc) => a + cc, 0); .reduce((a, cc) => a + cc, 0);
const pattern = (w % NFBR.a0X.a3h) + 1; const pattern = (w % NFBR.a0X.a3h) + 1;
const blocks = NFBR.a3E.a3f( const blocks = NFBR.a3E.a3f(
Width, Width + DummyWidth,
Height, Height + DummyHeight,
NFBR.a0X.a3g, NFBR.a0X.a3g,
NFBR.a0X.a3G, NFBR.a0X.a3G,
pattern, pattern,
@ -66,7 +68,12 @@ async function getFiles() {
const url = `${a5w.url}${page.url}`; const url = `${a5w.url}${page.url}`;
files.push({ url, blocks, width: Width, height: Height }); files.push({
url,
blocks,
width: Width,
height: Height,
});
} }
return files; return files;
@ -148,7 +155,7 @@ export function DmmBooks({ db, browser }: { db: Database; browser: Browser }) {
const page = await ctx.newPage(); const page = await ctx.newPage();
// TODO: --all // TODO: --all
await fs.mkdir(dir); // await fs.mkdir(dir);
await page.goto(book.readerUrl); await page.goto(book.readerUrl);
const files = await page.evaluate(getFiles); const files = await page.evaluate(getFiles);