A private, self-hosted toolbox that cleans up a comic library. It converts CBR/RAR/7z archives to CBZ, and writes ComicInfo.xml metadata into the files from ComicVine and Metron, so a reader such as Komga, Kavita or Grimmory can pick the books up properly.
It runs headless from the command line, or through a small password-protected web page for the same jobs. For private use only.
comicforge works on files and folders. You point it at your library, it reports what it would do, and only then does it change anything.
- Converts
.cbr,.rarand.7zto.cbz, and finds.cbzfiles that are really RAR/7z in disguise. - Tags each
.cbzwithComicInfo.xml(series, number, title, year, credits, characters, summary, links back to ComicVine/Metron), matched from the file and folder names. - Keeps its own ComicVine database (a public SQLite dump that it refreshes only when the mirror changes), so tagging is local and fast and needs no ComicVine account.
- Never guesses. If a name could be several series, it lists the candidates and writes nothing. You settle those by hand.
It is deliberately not a reader, a library browser, a user system, or a scheduler. It was carved out of CLU (GPL-3.0, see NOTICE) to keep the useful core without the rest.
- Back up the library. Conversion deletes originals (after verifying the new file) and tagging rewrites files.
- Fix mislabelled files:
.cbzfiles that are really RAR/7z are renamed.cbr. - Convert everything
.cbr/.rarto.cbz. - Update the ComicVine database (one download, then it only refreshes when the mirror changes).
- Check comics (read-only) to see which files already have metadata, and how every file and folder name is read.
- Tag as a dry run, read the report, then apply.
- Resolve what is left (the web page's ? button has the full guide): pick the right series by hand for one-shots and other unmatched files, from ComicVine or Metron.
Every step is a dry run until you say otherwise (--run on the command line, Apply changes in the web page).
cp .env.example .env && chmod 600 .env # fill in paths and COMICFORGE_UI_PASSWORD
mkdir -p $VOLUME_ROOT/state $VOLUME_ROOT/scratch
chown -R 99:100 $VOLUME_ROOT/state $VOLUME_ROOT/scratch
docker compose up -d
Open http://<host>:26642, sign in (any username, your COMICFORGE_UI_PASSWORD), and run ComicVine database with Apply changes on once to install the database. The image is ghcr.io/shredness/comicforge:latest. For a private repo, give the registry a token with read:packages or change the package's visibility.
The container is hardened: non-root (99:100, OMV nobody:users), read-only root filesystem, all capabilities dropped, no-new-privileges. The library is mounted at /data and lives outside the app's own volume.
comicforge serve (the default command in compose.yaml) serves a page with a task list, a folder picker, a live log and a results table.
- Tasks: check comics, fix mislabelled
.cbz, convert to CBZ, tag from ComicVine, update the ComicVine database. Each runs on the chosen folder and everything inside it. - Dry run by default. Nothing is written until Apply changes is switched on; convert and tag ask for confirmation first.
- Results are filterable by status. Rows that could not be matched have a Resolve button: paste a known ComicVine ID, or search ComicVine or Metron and pick the series, or edit the metadata by hand; preview, then apply it to that one file.
- One job at a time, with cancel. Logs and results are kept under
STATE_DIR/jobs(last 60 jobs) and survive a restart; a job that was running when the process died is marked interrupted.
Security: the UI can change and delete files, so it will not start without COMICFORGE_UI_PASSWORD (or _FILE). COMICFORGE_UI_ALLOW_NO_AUTH=1 overrides that for a trusted loopback only. It uses HTTP Basic auth over plain HTTP, so keep the published port on loopback or a trusted LAN address, or put it behind a TLS reverse proxy, and 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), and file names are only ever displayed as text. /healthz is the one unauthenticated endpoint.
Anything that changes files is a dry run unless --run is passed. In Docker: docker compose run --rm comicforge <command>.
comicforge fix-names PATH [--run] # .cbz files that are really RAR/7z -> .cbr
comicforge convert PATH [--run] [--keep-original] [--scratch DIR]
comicforge sync-comicvine [--check|--force] # refresh the local ComicVine database
comicforge parse PATH [--only low none] # how names and folders are read; no changes
comicforge tag-library PATH [--run] [--retag] [--metron] [--report out.tsv] [--limit N]
comicforge status # database state and which settings are set (no secrets)
comicforge info FILE.cbz # print a file's ComicInfo as JSON
comicforge tag FILE.cbz --set Series=Binary --set Number=1 [--clear Writer] [--fill-blank] [--run]
comicforge lookup --series Binary --number 1 --year 2025
comicforge tag-cv FILE.cbz --series Binary --number 1 [--year Y] [--volume-id N] [--run]
comicforge tag-cv FILE.cbz --cv-id 4000-123456 [--run] # known issue id or URL: exact
comicforge tag-cv FILE.cbz --cv-id 4050-12345 --number 3 [--run] # known volume id or URL
comicforge metron-lookup --series-id 1234 --number 5 # or --series NAME --year Y
comicforge tag-metron FILE.cbz --series-id 1234 --number 5 [--run]
comicforge serve [--port 26642] [--library DIR]
parse shows the series, number and year read from each file name and from its folders (__Publisher/_Creator/Series/, Series/2015/, Series/2025 Series/, and similar). Then tag-library reports every .cbz as one of:
| Status | Meaning |
|---|---|
would-tag / tagged |
confident match |
ambiguous |
several ComicVine volumes fit; candidates are listed |
no-volume, no-issue |
series or issue not found |
volume-mismatch, hint-conflict |
a folder's cvinfo/series.json disagrees with the file name or with each other |
unparsed |
no series name could be read |
needs-convert |
still a .cbr |
skipped-has-comicinfo |
already tagged (use --retag to rewrite) |
Rules worth knowing:
- The series name must match a ComicVine volume token-for-token. When several volumes share a name, the year (volume start year or the issue's cover year) or a folder's start-year hint decides; if it still can't, nothing is written.
- A folder's
cvinfo(a ComicVine volume URL) orseries.json(comicid,metron_id) pins the volume exactly, for the files in that folder and in year/volume split folders below it (2015/,2025 Series/,Vol 2/). It does not reach through a named subfolder: acvinfoin a character folder likeBatman/says nothing aboutBatman/Detective Comics/, and Check comics reports it as ignored. Hints also stop at the first_folder (publisher, creator, misc containers). Pinning refuses a folder that holds other series folders. - Files with no issue number match only single-issue volumes (one-shots, graphic novels). A
v01-style trade name is not guessed and lands in the report. - Folders starting with
_are containers, never series names, and are never skipped. Only dot-hidden names are skipped. Volumein the tag is the series start year, matching CLU, so files tagged by either tool agree.
- One file: in the web page, press Resolve on its row and paste the ID or URL into "Know the ComicVine ID?". An issue ID (
4000-…) tags exactly that issue; a volume ID (4050-…) uses the issue number box. From the CLI,tag-cv FILE --cv-id …. - A whole series: in Fix one file, choose the series and press Use this series for the whole folder. That writes the folder's
cvinfo(marked as pinned by comicforge), tags every untagged file in it, marks them resolved, and returns you to your list. A pin you make is trusted even when the file names differ from the series name; acvinfoleft by other tools is not. Container folders (starting with_) and folders already pinned to another series are refused. By hand: put acvinfofile in the series folder containing the volume URL (for examplehttps://comicvine.gamespot.com/binary/4050-12345/).tag-librarythen pins every file below it to that volume.
In Fix one file, press Edit by hand. The form shows the core ComicInfo fields, filled from the file's existing metadata, or from its name when it has none. Preview shows exactly what will be stored; Save to this file writes it. Only changed fields are sent, emptying a field removes it, and everything else in the file is kept. On a wide screen the fix panel opens to the right of the results. Each file you tag or save is marked resolved, drops out of the list (the resolved tile still shows it, and this survives a reload), and the next file that needs fixing opens; Skip moves on without changes. Check comics rows also have Edit / Tag buttons, so any .cbz can be fixed this way. From the CLI: comicforge tag FILE --set Series=X --set Number=1 --clear Writer --run.
A bare number is refused, because it could be either kind. IDs are looked up in the local database, so it needs to be reasonably current.
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.
--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.
In bulk, tag-library --metron (or the matching box in the web page) tries Metron only for rows ComicVine could not settle, and only where the folder gives a Metron series id. Name-only searches are not attempted in bulk because of the rate limit (about 10 files a minute). If Metron errors, it is switched off for the rest of the run and ComicVine tagging carries on. The report's source column shows which one tagged each file.
Copy .env.example to .env next to compose.yaml. .env and secrets/ are git-ignored, and CI fails if either is tracked.
| Setting | Notes |
|---|---|
VOLUME_ROOT |
the app's own volume: state/ (ComicVine database, several GB) and scratch/ (extraction). Override with STATE_DIR / SCRATCH_DIR. Create both and chown 99:100 |
COMICS_DIR |
the library, kept outside the app volume; mounted at /data |
PUID, PGID |
container user, default 99:100 |
UMASK |
default 002: files comicforge writes are 664, so SMB users in the same group can still edit and delete them |
COMICFORGE_UI_PASSWORD |
required to start the web UI |
UI_BIND, UI_PORT |
published address and port; default 127.0.0.1:26642 |
METRON_API_TOKEN |
Metron lookups |
COMICVINE_DUMP_URL |
optional; only to use a different mirror. A bare host gets https:// and /localcv.zip added |
COMICVINE_API_KEY |
optional; live ComicVine API 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, logs and the web page never include secret values.
The ComicVine database comes from a community mirror (localcv.nerdfirehurricane.com), not from ComicVine, and needs no credentials. Sync is probe-first (one HEAD request), downloads about 570 MB only when the mirror's copy changed, verifies the archive and schema, and swaps it in atomically, so a failed run leaves the installed copy alone.
- Conversion is all-or-nothing: the original is deleted only after the new CBZ reopens, passes a CRC test, and has at least as many pages as the source. Extraction tries
unrar, then7z, thenunar, and a failure reports what each tool said. - Salvage: old or damaged archives often make every tool report an error even though every page comes out. When one tool still extracts all the pages, the CBZ is built anyway and reported as
salvaged, with a check for truncated JPEG/PNG pages. The original is never deleted in that case: it is renamedNAME.cbr.orig, which readers and comicforge ignore. Delete those once you have looked at the new file. - Archives are built on local scratch space and then moved into place, which avoids failures on mergerfs/FUSE mounts.
- Tagging verifies the page count after rewriting.
- Files are replaced by writing a hidden temp file in the same folder and renaming it over the original, so a failure never leaves a half-written file, and files owned by other users (for example written by CLU as root) are replaced without touching their ownership. This needs write access to the folder: give the library's folders group
usersand mode2775(find DIR -type d -exec chmod 2775 {} +) and both the container and SMB users can work in them. - Dry run is the default everywhere; the web page and the CLI behave the same.
pip install -e ".[test]" pyflakes
pyflakes comicforge tests scripts && pytest -q
Every push to main runs the tests (Python 3.10, 3.12, 3.13), builds the image, smoke-tests it under the same restrictions as compose.yaml with real unrar/7z, and publishes ghcr.io/shredness/comicforge:latest plus a :<sha> tag. Pull requests run the same checks without publishing.
GPL-3.0-or-later. Derived in part from CLU; see NOTICE.