this is my app to retrieve, format and import Japanese books into Komga and Kobo.

I pilot the development of the software via a dialog with Claude on the Aozora manager app PRD ([[Product Requirement Document]])

# Where is the app located

the app resides in `/home/pygenot/Work/Apps/AozoraManager`

# Development

point to `~/Work/Apps/AozoraManager`
launch `cx`
when development is done, need to commit and run `make install`
# Usage

```bash
aozora 1.0.0 — convert Aozora Bunko (青空文庫) text/ZIP files to EPUB

Usage:
  aozora convert [options] [<file|folder>...] [-- <AozoraEpub3 args>]
  aozora <file|folder>...           shorthand for 'convert'
                                   Without files, convert converts the source_dir folder.
  aozora search [--author|--title] [--fetch] [-o <dir>] [--limit <n>] <words>...
  aozora fetch [-o <dir>] <work ID | card URL | ZIP URL>...
  aozora catalog [update]
  aozora remove [-n] [-y] [--keep-source] [-o <dir>] [<words or work IDs>...]
  aozora install [--version <tag>] [--dir <dir>] [--force]
  aozora doctor
  aozora config [list | get <key> | set <key> <value> | unset <key> |
                edit | edit-ini | path [ini]]
  aozora --help | --version

Convert options (override the config file):
  -o, --output <dir>         Output directory (default: current directory);
                             'kobo' writes to the Kobo found by kbm
  -r, --recursive            Also look in subfolders of folders given as input
      --kobo                 Then copy the books of the output folder that the Kobo
                             (found by kbm) doesn't have yet to its kobo_folder
      --name <template>      Output name: {author} {title} {basename} {id} (Aozora card
                             number); '/' makes folders [default: '{author} - {title}']
      --horizontal           Horizontal text (横書き)
      --vertical             Vertical text (縦書き) [default]
      --encoding <enc>       auto | MS932 | UTF-8 [default: auto]
      --cover <c>            Cover (表紙): auto | generate | first | same-name | none |
                             <image path or URL> [default: first, the first illustration].
                             generate makes one with the title and author; auto uses the
                             first illustration of a ZIP that has images, else generates.
      --[no-]cover-page      Also show the cover as the first page [default: on]
      --font <names>         Font for the text, by family name(s) installed on the reader,
                             e.g. 'BIZ UDMincho, BIZ UD明朝' [default: MS Mincho]
      --title-order <o>      How the title block at the top of the text is laid out:
                             title-author [default] | author-title |
                             title-author-subtitle | title-only | none
      --[no-]title-from-filename
                             Use the input file name as the title
      --format <f>           epub [default] | kepub (Kobo .kepub.epub)
      --[no-]kepubify        With kepub, convert with kepubify into a real Kobo kepub [default: on]
      --device <d>           Device-specific tweaks: none [default] | kindle
      --ini <file>           AozoraEpub3 ini file to use instead of the managed one
      --no-ini               Don't pass any ini file
      --margin-top <n>       Margins in characters, e.g. 1.5; they scale with the font size.
      --margin-bottom <n>    Each overrides the matching margin_* setting and the
      --margin-left <n>      ini's BodyMargin; sides left unset keep the ini's value
      --margin-right <n>
      --[no-]skip-existing   Skip books converted before, without starting Java [default: on]
      --[no-]overwrite       Convert again and replace existing output files
  -j, --jobs <n>             Convert n books at the same time [default: 1]
  -n, --dry-run              Show what would be done, without converting or writing
      --[no-]check           Validate each book with epubcheck [default: off]
      --force                Also convert texts that don't look like Aozora Bunko texts
  -q, --quiet                Only print errors
      --log <file>           Write AozoraEpub3's and kepubify's full output to a file
      --jar-dir <dir>        AozoraEpub3 install directory
  -v, --verbose              Show AozoraEpub3's own output
  -h, --help                 Show this help

Arguments after '--' are passed to AozoraEpub3 unchanged. A ZIP holding several
texts gives one book per text. Each output folder keeps a .aozora-index of the books
converted into it, which is how books converted before are recognised.

Search and fetch:
  search looks up works in the Aozora Bunko catalogue (downloaded to
  ~/.cache/aozora/catalog.tsv and refreshed weekly) by title, reading, subtitle
  or author (kanji, hiragana reading or romaji); --author or --title narrows it.
  Each line shows the work ID, title, author and spelling (新字新仮名 / 旧字旧仮名; © when
  the work is still under copyright but published with permission).
  search --fetch picks works from the results (with fzf when installed) and fetches them.
  fetch downloads each work's text ZIP into source_dir (or -o), skipping ones already there.

Remove:
  remove deletes books from the library: the converted book in output_dir (or -o), its
  source file, and the Kobo's copy when the Kobo is connected. Books are named by words
  of the book's or source's name, or by work ID; without any, pick them in fzf. It lists
  everything it will delete and asks first.
      -n, --dry-run          Only list what would be deleted
      -y, --yes              Don't ask (needs words or IDs)
      --keep-source          Keep the source file (the book comes back on the next convert)

Install options:
      --version <tag>        Release to install, e.g. v1.1.1b34Q [default: latest]
      --dir <dir>            Install directory [default: where aozora looks, see below].
                             Another directory is saved as jar_dir in the config.
      --force                Replace an existing install (its AozoraEpub3.ini is kept)

Configuration:
  Settings file:  ~/.config/aozora/config   ('aozora config list' shows them)
  Managed ini:    ~/.config/aozora/AozoraEpub3.ini
                  AozoraEpub3 layout settings (fonts, margins, table of contents,
                  images) used for every conversion; create it with 'aozora config edit-ini'.

Kobo:
  --kobo copies the books of the output folder to the kobo_folder folder [Aozora] of
  the Kobo that 'kbm device' reports, when it doesn't have them or has older copies;
  it never deletes. With output_dir=kobo (or -o kobo), books are written there directly.
  Set kbm's location with 'config set kbm'.

Finding AozoraEpub3 (first match wins):
  --jar-dir, $AOZORA_EPUB3_HOME, jar_dir in the config, ~/.local/share/aozora/AozoraEpub3

Exit codes:
  0 success   1 at least one failure   2 usage error   3 missing dependency
```

# Links

https://www.aozora.gr.jp/


---
Tags:: #software #claude
Up:: [[Stuff I build]]
Hub:: [[📇 Softwares]]