Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

comicforge

Headless CBR/RAR/7z → CBZ conversion and ComicInfo.xml tagging for a self-hosted comic library. No web UI, no accounts, no library database. Private use.

Derived in part from CLU (GPL-3.0). See NOTICE.

Requirements

Python 3.10+, defusedxml, and one of unrar / 7z / unar on the PATH.

Commands

Anything that changes files is a dry run unless --run is passed.

comicforge fix-names PATH              # list .cbz files that are really RAR/7z
comicforge fix-names PATH --run        # rename them to .cbr
comicforge convert PATH                # list what would convert
comicforge convert PATH --run --scratch /tmp
comicforge info FILE.cbz               # print ComicInfo fields as JSON
comicforge tag FILE.cbz --set Series=Binary --set Number=1 [--fill-blank] --run
comicforge sync-comicvine [--check|--force]   # refresh the local ComicVine database
comicforge lookup --series Binary --number 1 --year 2025
comicforge tag-cv FILE.cbz --series Binary --number 1 --year 2025 [--volume-id N] --run
comicforge parse /data [--only low none]        # how names/folders parse; no database, no changes
comicforge tag-library /data --report out.tsv   # dry run: what would be tagged, and why not
comicforge tag-library /data --run [--retag]    # tag every confident match
comicforge status                      # database state + which settings are set (never prints secrets)

tag and tag-cv are dry runs until --run. tag-cv writes only on a confident match: the series name must match a ComicVine volume token-for-token, and when several volumes share a name it uses the year (volume start year, or the issue's cover year) to pick one. If it still can't decide it writes nothing, lists the candidates, and you choose with --volume-id.

Tagging a library

Run parse first. It shows the series, number and year read from each name and from the folders (__Publisher/Character/Year Series/ and similar), and --only low none lists the names it could not read. Then tag-library as a dry run: every .cbz is reported as would-tag, ambiguous (several ComicVine volumes fit; candidates listed), no-volume, no-issue, unparsed, needs-convert (still a .cbr) or skipped-has-comicinfo. Only would-tag files are written with --run, and files that already have a ComicInfo.xml are left alone unless you pass --retag.

Folders starting with _ are treated as containers (publisher, misc), never as series names, and are never skipped. Files with no issue number are matched only to single-issue ComicVine volumes (one-shots, graphic novels). A v01-style trade name is not guessed and lands in the report.

Configuration

Copy .env.example to .env next to compose.yaml, fill it in, and chmod 600 .env. .env and secrets/ are git-ignored, and CI fails if either is tracked.

Setting Needed for Notes
VOLUME_ROOT everything the app's own volume: state/ (ComicVine database, several GB) and scratch/ (extraction). Override with STATE_DIR / SCRATCH_DIR
COMICS_DIR everything the library, kept outside the app volume; mounted at /data
PUID, PGID everything default 99:100 (OMV nobody:users)
COMICVINE_DUMP_URL optional the local ComicVine database needs no credentials; override only to use a different mirror
METRON_API_TOKEN Metron (not built yet) token only; Metron's client dropped username/password
COMICVINE_API_KEY optional live API lookups only, not the local database

Any setting also accepts NAME_FILE=/path (for example METRON_API_TOKEN_FILE=/run/secrets/metron_api_token). The file wins, and an unreadable file is an error. Output and logs never include secret values.

The ComicVine database comes from a community mirror, not from ComicVine. Sync is probe-first (one HEAD request), downloads only when the mirror's version changed, verifies the archive and schema, and swaps the file in atomically, so a failed run leaves the installed copy alone. A daily host cron or Dockhand schedule running sync-comicvine is cheap.

Conversion is all-or-nothing and the original is deleted only after the new CBZ reopens, passes a CRC test, and has at least as many pages as the source. Only dot-hidden names are skipped; folders starting with _ are always included.

Docker

Every push to main runs tests (Python 3.10/3.12/3.13), builds the image, smoke-tests it under the same restrictions as compose.yaml (non-root, read-only root, no capabilities), and publishes ghcr.io/shredness/comicforge:latest plus a :<sha> tag. Pull requests run the same checks without publishing.

The image bundles unrar, 7z and unar. Run it as a one-shot tool (dry run unless --run):

export COMICS_DIR=/path/to/comics SCRATCH_DIR=/path/to/local/scratch
docker compose run --rm comicforge fix-names /data
docker compose run --rm comicforge convert /data --run

SCRATCH_DIR should be a local disk, not the data mount. Extraction and zip assembly happen there. Default user is 99:100 (OMV nobody:users); override with PUID/PGID.

GHCR packages from a private repo are private: add ghcr.io as a registry with a token that has read:packages, or change the package visibility.

Metron

Needs METRON_API_TOKEN (create it on your metron.cloud account page; username/password is no longer used). Metron allows at least 20 requests/minute and 5,000/day; on a 429 the client waits the Retry-After it is given (up to about 75 s) and otherwise stops with an error.

comicforge metron-lookup --series-id 1234 --number 5      # print ComicInfo, write nothing
comicforge metron-lookup --series Binary --year 2025 --number 1
comicforge tag-metron FILE.cbz --series-id 1234 --number 5 [--run]

--series-id is the Metron id from a folder's cvinfo (series_id:) or series.json (metron_id). Name lookups need an exact series name; same-name series are listed, never guessed. Notes carry urn:metron:issue:<id> (and the ComicVine urn when Metron knows it).

In bulk: comicforge tag-library DIR --metron (or the "Fall back to Metron" box in the UI) tries Metron only for rows ComicVine could not settle (ambiguous, no volume, no issue) and only where the folder's cvinfo/series.json gives a Metron series id; name-only searches are not attempted in bulk because of the rate limit (about 10 files/minute, two requests each). If Metron errors (bad token, limit reached) it is switched off for the rest of the run and ComicVine tagging carries on. The report has a source column. In the UI's Resolve panel pick "Metron" as the source to search and apply a single file.

Web UI

comicforge serve (the default in compose.yaml) runs a small web page that wraps the same commands: pick a folder, choose a task, watch the log, then review a results table. Everything is a dry run unless Apply changes is ticked. Rows ComicVine could not match have a Resolve button: search a volume, pick it, preview the ComicInfo, apply it to that one file (for loose one-shots).

  • One job at a time; the log and results persist under STATE_DIR/jobs (last 60 jobs).
  • Password required. Set COMICFORGE_UI_PASSWORD (or _FILE). Without it the server refuses to start; COMICFORGE_UI_ALLOW_NO_AUTH=1 overrides that for a trusted loopback only.
  • HTTP Basic auth over plain HTTP: keep the published port on loopback or a trusted LAN address, or put it behind a TLS reverse proxy. Do not expose it to the internet.
  • State-changing requests need an X-Requested-With header and a same-origin Origin; every path is resolved inside the library root (symlinks included); file names are rendered as text.
  • Library root is COMICFORGE_LIBRARY (default /data). /healthz is unauthenticated.

Roadmap

ComicVine SQLite dump sync, Metron client, matcher, run command for the full sequence.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages