Repository navigation
dokuha-cli 0.1.1
Kindle series discovery is one request for the whole series, with the access, offer and sampler probes run at once. Progress reporting fixes, and documentation corrected where it described the removed walk.
v0.1.1
Added
- Kindle series discovery is one request, not one per volume. A series list comes from the store's
seriesAsinListendpoint at a page size of 100, so a 72-volume series arrives in a single call, and the per-volume access, Kindle Unlimited offer and 試し読み probes then run at once instead of in a chain where each answer named the next volume. Discovery for a nine-volume series went from roughly twenty seconds to about ten, with the probes themselves at one second. The collection ASIN the endpoint needs is read from the Kindle product page, and when a volume has no such page, which is the case for Kindle Unlimited only titles, it is found through a related volume instead of being treated as a series with no volumes. A discovery that fails outright is now reported rather than falling back to downloading a single volume, which previously hid a nine-volume series behind one book. - BookWalker pages are named after the manifest source they came from. A page written from
OEBPS/text/cover.xhtmlis now0001 cover.jpginstead ofpage-0001.jpg, in the folder, in the filename sent to mokuro-bridge, and in the ZIP entry. The stem is sanitized for every target filesystem and truncated by encoded length so the whole entry fits 255 UTF-8 bytes. The four-digit ordinal stays first, so a plain name sort is still reading order. Ported from the userscript repo's PR #1; the naming policy lives insrc/download/page-files.jsand reaches the engine as the optionaloptions.pageName(index, source, extension), which defaults to the old name. - A newer release is announced, and
--updateinstalls it. After a normal rundokuhaprints one line to stderr when npm has a newerdokuha-cli, at most one registry request a day, cached under~/.cache/dokuha-cli/. The check starts before the download and is read after it with a short bound, so it never delays a run, and every network failure is silent. It stays off for--json,--quietand any non-terminal stderr, where a script may be parsing output;DOKUHA_UPDATE_NOTICE=1opts a non-terminal back in andDOKUHA_NO_UPDATE_CHECK=1disables the notice entirely.dokuha --check-updateasks immediately, bypassing the day-long cache, and exits 0 when current, 1 when a newer release exists and 2 when the check failed.dokuha --updateprints and then runsnpm install -g dokuha-cli@latestfor a global npm install, and refuses with one line when the running copy is a git checkout or a local path install, including annpm link, where that command would upgrade the wrong thing. No new dependency: the check uses the runtimefetchagainsthttps://registry.npmjs.org/dokuha-cli/latest, and the comparison tolerates a leadingvand prerelease tags.
Fixed
--download-samplersdid nothing on k-manga. Its resolver read aconfig.samplersthat is never set, while every other store readsctx.samplers, so the flag was silently ignored for that store alone. It now lists the free volumes and the 試し読み previews.--dest-folderwas resolved against the bridge's directory. A relative path landed next to mokuro-bridge, not next to the command that was run. The CLI now resolves it on this machine, like--out.- A mistyped
@filecookie failed one volume at a time.--bw-cookieand--kindle-cookienow check that an@FILEexists while parsing, so a typo is one message at startup instead of a failure per store. - A Kindle Unlimited return could fail on the first lookup. Amazon's
your-bookslisting lags the borrow, and one lookup on the first miss marked a finished volume as failed and left the loan open against the six-slot ceiling. The lookup retries with a fresh listing. - ebookjapan pages came out as a shuffled mosaic. The viewer WASM emits each page's tile coordinates in the coordinate space of the box asked for by
open_param, and the CLI read those coordinates out of the CDN image, which is served at the page's intrinsic size. Asking for a downscaled box (size: 1200) made every source offset land in the top-left corner of the image, so every rebuilt page was a patchwork of unrelated fragments. Asking for the intrinsic box fixes it, the same volume that took 8 minutes and produced unreadable pages now takes 26 seconds and produces clean, full-resolution pages. Volumes already downloaded this way look complete to the resume gate; re-fetch them with--force. - A resumed volume trusted a truncated page. The whole-volume "already present" gate counted image files and compared the count to the expected pages, so a half-written
page-0002.jpgmade the folder look complete. Every store now validates each page with one shared completeness check (isCompleteImageFile), and a skipped volume reports the bytes actually on disk instead of0. This is what the four failing Kindle resume checks were reporting. - A URL could be handed to the wrong store. Detection tried every store's unanchored pattern in order, so a link to Amazon inside an ebookjapan URL's query string resolved to Kindle. An absolute URL is now claimed by the store that owns its host before any pattern is tried, and an ebookjapan homepage or account page is no longer displayed as a downloadable volume.
- Kindle
--seriesdropped the session. The registry callsseries(det, input, ctx)but the walk expected(det, config, io), so the config was a URL string and--kindle-cookiewas ignored on that path. The descriptor now adapts at the seam. - Skip paths bypassed the result contract. The "already present" and Kindle Unlimited skip paths did not go through
normalizeStoreResult, and the KU path setskippedtotruewhere every other result uses a page count. FORCE_COLOR=0forced colour on, andNO_COLORoverrodeFORCE_COLOR;FORCE_COLORnow wins and0means off.--dry-runexited 0 with nothing to do while the same run without it exited 2. The exit code no longer depends on a dry run.- A missing option value leaked Node's wording (
argument missing); it now names the flag, and a misspelled flag suggests the real one. - Documented ranges were not enforced:
--jpeg-qualityis 1-100 and--km-concurrencyis 1-32. - A fatal error printed a raw stack. A full disk, a permission error, a refused connection, an unknown host and a reset connection now each get one actionable sentence naming the likely cause.
Changed
-
The overall progress bar weights each volume by its page count. Counting every volume equally meant a twelve-page sampler finishing advanced the bar as far as a two-hundred-page volume finishing, so a run could look nearly green while the real work had barely started. A volume completed in an earlier run now also counts as downloaded, which is what keeps a resumed run's bar green rather than dyed cyan from the assemble band alone.
-
The row bar stops one cell short while finalizing. A full bar beside an upload at zero percent read as a finished volume.
-
One shared "already present" gate decides whether a volume is done.
src/download/existing-volume.jsruns ahead of every adapter's page loop. It validates each image with the sharedisCompleteImageFilecheck rather than counting files, sums the bytes actually on disk, and can ask the bridge whether the volume already exists at the destination, so a repeat run skips both the download and the OCR. -
Four dead flags removed.
--title-dir(a no-op alias),--kindle-max-volumes(parsed, read nowhere),--bw-login(always refused),--local-dir(an alias of--dest local --dest-folder DIR). -
--overwritemerged into--force, which already meant "ignore what is already there". -
--descramblewith--no-descrambleis now an error instead of silently letting--descramblewin regardless of order. -
--helpis two-tier: the dozen flags a normal run needs, then an Advanced section for store-specific and tuning options. -
The bridge wait loops are bounded by
--ocr-waitinstead of polling forever, and the completion marker is a size/mtime signature rather than a SHA-256 of every page, so a resumed run no longer reads the whole volume back off disk. -
The summary now separates download time from OCR time, so a long
--mokurorun is not mistaken for slow downloading, and it names how many URLs were not recognised instead of leaving that to the lines above. -
src/detect.jsdeleted;src/platforms/index.jsis the only detection entry point. -
--quietand--no-progressstay separate.--quietsilences the run;--no-progressreplaces the live block with one plain line per volume. They were reviewed as a merge candidate and kept, because merging them would have removed a behaviour rather than a duplicate.