An extensible library to manage comic archives and their embedded files and metadata.
Project description
Comic Archive
An extensible library to manage comic archives and their embedded files and metadata.
Supported Formats
More can be added by extending the respective base class and adding to the registry.
Archives
| Archive | Extra Required |
|---|---|
| .cbz, .zip | builtin |
| .cbt, .tar | builtin |
| .cbr, .rar | cbr |
| .cb7, .7z | cb7 |
Compability Table
| Format | Read | Update | Create |
|---|---|---|---|
| cbz | ✅ | ✅ | ✅ |
| cbt | ❌ | ❌ | ✅ |
| cbr | ✅ | ❌ | ❌ |
| cb7 | ✅ | ❌ | ✅ |
| ✅ | ✅ | ❌ |
If something is marked as in-compatible the library will try extracting and making the change via the local system and re-archive (if it has the create capability).
Metadata
Installation
pdm add comic-archive
Optional extras can be added as needed:
pdm add comic-archive[cbr,cb7,pdf]
Usage
from pathlib import Path
from comic_archive import Comic
from comic_archive.metadata import MetronInfo
my_comic = Path("MyComic.cbz")
with Comic.open(my_comic) as comic:
print(comic.list_filenames())
print(comic.read_file(filename="page-1.jpg").decode("UTF-8"))
print(comic.metadata) # Dict of registered metadata in archive
metron_info = comic.get_metadata(metadata_type=MetronInfo)
print(metron_info.series)
Writing files and metadata (support depends on the archive format, see table above):
with Comic.open(my_comic) as comic:
comic.write_file(filename="page-99.jpg", data=b"...", override=True)
comic.remove_file(filename="page-01.jpg")
metron_info = comic.get_metadata(metadata_type=MetronInfo)
metron_info.series.name = "Updated Title"
comic.set_metadata(metron_info)
You can also convert between different archives (as long as the destination archive has create capability)
from comic_archive.archives import ZipArchive
rar_comic = Path("MyComic.cbr")
with Comic.open(rar_comic) as comic:
print(comic.file) # MyComic.cbr
comic.convert(
ZipArchive, delete_original=True
) # All future comic interactions will be on the new archive
print(comic.file) # MyComic.cbz
Socials
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file comic_archive-0.1.1.tar.gz.
File metadata
- Download URL: comic_archive-0.1.1.tar.gz
- Upload date:
- Size: 212.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a489587b996f5f154b80867f171695f5d0f7cab1f2e2a2b2138cfda74bfd5a4a
|
|
| MD5 |
c1b24cb5d3b9dd6814e141d5f5e9865e
|
|
| BLAKE2b-256 |
ce19497436aea51f1558f01f436cb5daeced9695435cd45d8fe8b08673770f44
|
File details
Details for the file comic_archive-0.1.1-py3-none-any.whl.
File metadata
- Download URL: comic_archive-0.1.1-py3-none-any.whl
- Upload date:
- Size: 19.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab3791f3bfe602490897524ec389de9d5c35dcdaaaae401680e5459d0c88020b
|
|
| MD5 |
bab29dfffb640906560954383fb8652c
|
|
| BLAKE2b-256 |
abd779d9a7adec802b69434471f889549ecac8e900cf83f58f96bfb0291fa99a
|