@@ -12,7 +12,14 @@ import sharp from 'sharp'
1212
1313import type { BookMetadata , TocItem } from './types'
1414import { parsePageNav , parseTocItems } from './playwright-utils'
15- import { assert , getEnv , normalizeAuthors , parseJsonpResponse } from './utils'
15+ import {
16+ assert ,
17+ // extractTar,
18+ getEnv ,
19+ // hashObject,
20+ normalizeAuthors ,
21+ parseJsonpResponse
22+ } from './utils'
1623
1724// Block amazon analytics requests
1825// (not strictly necessary, but adblockers do this by default anyway and it
@@ -148,8 +155,20 @@ async function main() {
148155 result . info = body
149156 } else if ( url . pathname === '/renderer/render' ) {
150157 // TODO: these TAR files have some useful metadata that we could use...
158+ // const params = Object.fromEntries(url.searchParams.entries())
159+ // const hash = hashObject(params)
160+ // const renderDir = path.join(userDataDir, 'render', hash)
161+ // await fs.mkdir(renderDir, { recursive: true })
151162 // const body = await response.body()
152- // const tempDir = await extractTarToTemp(body)
163+ // const tempDir = await extractTar(body, { cwd: renderDir })
164+ // const { startingPosition, skipPageCount, numPage } = params
165+ // console.log('RENDER TAR', tempDir, {
166+ // startingPosition,
167+ // skipPageCount,
168+ // numPage
169+ // })
170+ // TODO: if `location_map.json` exists, record `navigationUnit` map of positions to pages
171+ // TODO: `page_data_0_5.json` has start/end/words for each page in this render batch
153172 // const toc = JSON.parse(
154173 // await fs.readFile(path.join(tempDir, 'toc.json'), 'utf8')
155174 // )
0 commit comments