An API for reading comic archives
Project description
Comicbox
A comic book archive metadata reader and writer.
✨ Features
📚Comic Formats
Comicbox reads CBZ, CBR, CBT, and optionally PDF. Comicbox archives and writes CBZ archives and PDF metadata.
🏷️ Metadata Formats
Comicbox reads and writes:
- ComicRack Comicinfo.xml v2.1 (draft) schema,
- Comic Book Lover ComicBookInfo schema
- CoMet schema.
- PDF Metadata.
- A variety of filename schemes that encode metadata.
Usefulness
Comicbox's primary purpose is a library for use by Codex comic reader. The API isn't well documented, but you can infer what it does pretty easily here: comicbox.comic_archive as the primary interface.
The command line is increasingly useful and can read and write metadata recursively and extract pages.
Limitations and Alternatives
Comicbox does not use popular metadata database APIs or have a GUI!
Comictagger is a popular alternative. It does most of what Comicbox does but also automatically tags comics with the ComicVine API and has a desktop UI.
📦 Installation
pip install comicbox
Comicbox supports PDFs as an extra when installed like:
pip install comicbox[pdf]
Dependencies
Comicbox generally works without any binary dependencies but requires unrar
be on the path to convert CBR into CBZ or extract files from CBRs.
⌨️ Usage
Console
Type
comicbox -h
see the CLI help.
Examples
comicbox test.cbz -m "{Tags: a,b,c, story_arcs: {d:1,e:'',f:3}" -m "Publisher: SmallComics" -w cr
Will write those tags to comicinfo.xml in the archive.
But it's probably better to use the --print action to see what it's going to do before you actually write to the archive:
comicbox test.cbz -m "{Tags: a,b,c, story_arcs: {d:1,e:'',f:3}" -m "Publisher: SmallComics" -p
A recursive example:
comicbox --recurse -m "publisher: SC Comics" -w cr ./SmallComicsComics/
Will recursively change the publisher to "SC Comics" for every comic found in under the SmallComicsComics directory.
Packages
Comicbox actually installs three different packages:
comicbox
The main API and CLI script.comicfn2dict
A separate library for parsing comic filenames into dicts it also includes a CLI script.pdffile
A utility library for reading and writing PDF files with an API like Python's ZipFile
⚙️ Config
comicbox accepts command line arguments but also an optional config file and environment variables.
The variables have defaults specified in a default yaml
The environment variables are the variable name prefixed with COMICBOX_
. (e.g. COMICBOX_COMICINFOXML=0)
Log Level
change logging level:
LOGLEVEL=ERROR comicbox -p <path>
🛠 Development
You may access most development tasks from the makefile. Run make to see documentation.
🤔 Motivation
I didn't like Comictagger's API, so I built this for myself as an educational exercise and to use as a library for Codex comic reader.
📋 Schemas
Comicbox supports reading and writing several comic book metadata schemas.
Filename Schema
Comicbox includes a pretty good comic archive filename parser. It can extract a number of common fields from comic archive filenames.
Location | Name |
---|---|
Archive | The archive filename |
Import/Export | comicbox-filename.txt |
PDF Schema
The pdf metadata standard. Can be exported as an xml file or written directly to the pdf itself.
Adobe PDF Namespace Adobe PDF Standard § 14.3.3 Document Information Dictionary
PDF metadata is only read or written from and to PDF files.
Location | Name |
---|---|
Archive | PDF internal |
Import/Export | pdf-metadata.xml |
CoMet Schema
An old and uncommon comic metadata standard from a defunct comic book reader.
Location | Name |
---|---|
Archive | comet.xml |
Import/Export | comet.xml |
ComicBookInfo Schema (Comic Book Lover)
The Comic Book Lover schema. A rare but still encountered JSON schema. It probably survives because Comictagger supports writing it.
Location | Name |
---|---|
Archive | Zip & Rar Comments |
Import/Export | comic-book-info.json |
ComicInfo Schema (Comic Rack)
The Comic Rack schema. The de facto standard of comic book metadata. The Comic Rack reader is defunct, but the Anansi Project now publishes the ComicInfo spec and has compatibly and conservatively extended it.
Anansi ComicInfo v2.1 Spec Also, an unofficial, undocumented Mylar extension to ComicInfo.xml that encodes multiple Story Arcs and Story Arc Numbers as CSV values.
Location | Name |
---|---|
Archive | comicinfo.xml |
Import/Export | comicinfo.xml |
ComicTagger Schema
The most useful comic book metadata writer is ComicTagger. It supports the ComicVine API, is extensible to other APIs, and features a nice desktop GUI. Internally, Comictagger keeps a metadata object to work with the schemas it supports. This schema allows the import and export of that schema.
Comictaggger genericmetadata.py
This schema may only be useful to developers. The author of ComicTagger offers no promises as to the stability of this API and I am very lazy, so the chances of this drifting out of date are anyone's guess. It was included because it was easy to do.
Location | Name |
---|---|
Archive | comictagger.json |
Import/Export | comictagger.json |
Comicbox Schema
The comicbox internal data structure which acts as a superset of the above schemas to allow interpolating.
JSON Format
Location | Name |
---|---|
Archive | comicbox.json |
Import/Export | comicbox.json |
YAML Format
YAML is a superset of JSON, so the JSON schema applies here.
Location | Name |
---|---|
Archive | comicbox.yaml |
Import/Export | comicbox.yaml |
CLI Format
The Comicbox CLI uses "flow style" YAML, which is an all on one line format to enter metadata on the command line.
Location | Name |
---|---|
Comicbox CLI | -m --metadata |
Archive | comicbox-cli.yaml |
Import/Export | comicbox-cli.yaml |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file comicbox-1.0.0rc4.tar.gz
.
File metadata
- Download URL: comicbox-1.0.0rc4.tar.gz
- Upload date:
- Size: 81.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.7 Linux/5.15.0-1050-aws
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d2147ca60c37d7d767c7f14e9436b6ef927287338ff340fc3502a9f54a248f6 |
|
MD5 | 4ad5e26f40c78bad2cfde40be6a51e3c |
|
BLAKE2b-256 | 94b10edd6658b2fa1236b68193a074b35de0a50d742a662b5c96503744bfe365 |
File details
Details for the file comicbox-1.0.0rc4-py3-none-any.whl
.
File metadata
- Download URL: comicbox-1.0.0rc4-py3-none-any.whl
- Upload date:
- Size: 95.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.7 Linux/5.15.0-1050-aws
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e19d60b53271bb7d057c494780875fcc89adffea9c347eab7495e4b62f7ee1c |
|
MD5 | 6617e69ecc825b309fd27106578e1315 |
|
BLAKE2b-256 | 2f4d9098ceef134bf1c2686e1d28e567c64d3e0295e3e49057bcee84763248e3 |