Skip to content

dokuha-cli 0.1.1

Choose a tag to compare

@GolyBidoof GolyBidoof released this 14 Oct 00:57
· 4 commits to main since this release

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 seriesAsinList endpoint 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.xhtml is now 0001 cover.jpg instead of page-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 in src/download/page-files.js and reaches the engine as the optional options.pageName(index, source, extension), which defaults to the old name.
  • A newer release is announced, and --update installs it. After a normal run dokuha prints one line to stderr when npm has a newer dokuha-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, --quiet and any non-terminal stderr, where a script may be parsing output; DOKUHA_UPDATE_NOTICE=1 opts a non-terminal back in and DOKUHA_NO_UPDATE_CHECK=1 disables the notice entirely. dokuha --check-update asks immediately, bypassing the day-long cache, and exits 0 when current, 1 when a newer release exists and 2 when the check failed. dokuha --update prints and then runs npm install -g dokuha-cli@latest for a global npm install, and refuses with one line when the running copy is a git checkout or a local path install, including an npm link, where that command would upgrade the wrong thing. No new dependency: the check uses the runtime fetch against https://registry.npmjs.org/dokuha-cli/latest, and the comparison tolerates a leading v and prerelease tags.

Fixed

  • --download-samplers did nothing on k-manga. Its resolver read a config.samplers that is never set, while every other store reads ctx.samplers, so the flag was silently ignored for that store alone. It now lists the free volumes and the 試し読み previews.
  • --dest-folder was 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 @file cookie failed one volume at a time. --bw-cookie and --kindle-cookie now check that an @FILE exists 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-books listing 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.jpg made 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 of 0. 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 --series dropped the session. The registry calls series(det, input, ctx) but the walk expected (det, config, io), so the config was a URL string and --kindle-cookie was 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 set skipped to true where every other result uses a page count.
  • FORCE_COLOR=0 forced colour on, and NO_COLOR overrode FORCE_COLOR; FORCE_COLOR now wins and 0 means off.
  • --dry-run exited 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-quality is 1-100 and --km-concurrency is 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.js runs ahead of every adapter's page loop. It validates each image with the shared isCompleteImageFile check 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).

  • --overwrite merged into --force, which already meant "ignore what is already there".

  • --descramble with --no-descramble is now an error instead of silently letting --descramble win regardless of order.

  • --help is 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-wait instead 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 --mokuro run 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.js deleted; src/platforms/index.js is the only detection entry point.

  • --quiet and --no-progress stay separate. --quiet silences the run; --no-progress replaces 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.