Skip to main content

Shortbox

PyPI - Python PyPI - Status PyPI - Version PyPI - License

prek Ruff ty

status-badge

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
.pdf pdf

Compability Table

Format Read Update Create
cbz
cbt
cbr
cb7
pdf

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 shortbox

Optional extras can be added as needed:

pdm add shortbox[cbr,cb7,pdf]

Usage

from pathlib import Path

from shortbox import Comic
from shortbox.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 shortbox.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

Social - Matrix

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shortbox-0.4.0.tar.gz (218.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shortbox-0.4.0-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file shortbox-0.4.0.tar.gz.

File metadata

  • Download URL: shortbox-0.4.0.tar.gz
  • Upload date:
  • Size: 218.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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

Hashes for shortbox-0.4.0.tar.gz
Algorithm Hash digest
SHA256 7eac98c114991bf95f52a87b514eaeb0278072f60ee3e356fa1aad4092d7cf31
MD5 a7403081acb204d3a9fb886913b45e93
BLAKE2b-256 eec332732d8193a66b44b5895bcfb292216d234d76ff97dc05e5425be7e22711

See more details on using hashes here.

File details

Details for the file shortbox-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: shortbox-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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

Hashes for shortbox-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4ac6e6afb670affe9eaa4a2cf3b25b21a29b1119cbc34c2bff0c6b4abf571067
MD5 1bf3dc290616862caf823a7290d5985d
BLAKE2b-256 a05b09c4cc6d80e65dd63a3f1983f284d6cf0e3341fdf4e6f374bf96a1814a2c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page