Skip to content

Metron-Project/darkseid

Repository files navigation

Darkseid

PyPI - Version PyPI - Python Ruff Pre-Commit

A Python library to interact with comic archives.

Installation

pip install darkseid

There are optional dependencies which can be installed by specifying one or more of them in braces e.g. darkseid[7zip]

The optional dependencies are:

  • 7zip: Provides support for reading/writing to CB7 files.

  • pillow: Provides support for getting page information that is used with ComicInfo.xml metadata.

  • pdf: Provides support for reading/writing metadata in PDF comics and exporting them to CBZ format.

    The pymupdf dependency includes pre-built wheels for most platforms. On some platforms (e.g., Linux ARM, Windows), installation may require libstdc++ and C/C++ build tools to compile libmupdf. See the pymupdf documentation for details.

Example

from pathlib import Path
from darkseid.comic import Comic, MetadataFormat

comic = Comic(Path("my_comic.cbz"))

# Check if it's a valid comic
if comic.is_valid_comic():
    print(f"Comic '{comic.name}' has {comic.get_number_of_pages()} pages")

# Read metadata
if comic.has_metadata(MetadataFormat.COMIC_INFO):
    metadata = comic.read_metadata(MetadataFormat.COMIC_INFO)
    print(f"Series: {metadata.series.name}")

# Get a page
page_data = comic.get_page(0)  # First page
if page_data:
    with open("cover.jpg", "wb") as f:
        f.write(page_data)

Documentation

Read the project documentation

Bugs/Requests

Please use the GitHub issue tracker to submit bugs or request features.

About

Python library to interact with comic archives

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •