forked from mirrors/cbz
74 lines
2.2 KiB
Markdown
74 lines
2.2 KiB
Markdown
# PyCBZHelper
|
|
|
|
[](https://github.com/hyugogirubato/pycbzhelper/blob/main/LICENSE)
|
|
[](https://github.com/hyugogirubato/pycbzhelper/releases)
|
|
[](https://pypi.org/project/pycbzhelper/)
|
|
|
|
PyCBZHelper is a Python library for creating CBZ (Comic Book Zip) files with metadata. It provides functionality to
|
|
generate a CBZ file from a list of image pages and associated comic book metadata.
|
|
|
|
## Features
|
|
|
|
- Create CBZ files from images.
|
|
- Generate ComicInfo.xml metadata.
|
|
- Support for various metadata fields.
|
|
- Handle page files from local disk or web URLs.
|
|
- Automatic cleanup of temporary files.
|
|
|
|
## Installation
|
|
|
|
You can install PyCBZHelper using pip:
|
|
|
|
````shell
|
|
pip install pycbzhelper
|
|
````
|
|
|
|
## Usage
|
|
|
|
Here's a basic example of how to use PyCBZHelper:
|
|
|
|
````python
|
|
from pycbzhelper import Helper
|
|
from pathlib import Path
|
|
|
|
PARENT = Path(__name__).resolve().parent
|
|
|
|
if __name__ == "__main__":
|
|
# Define metadata for the comic
|
|
metadata = {
|
|
"Title": "My Comic",
|
|
"Series": "Comic Series",
|
|
"Number": "1",
|
|
"Pages": [
|
|
{"File": PARENT / "image1.jpg"},
|
|
{"File": PARENT / "image2.jpg"},
|
|
]
|
|
# Add more metadata fields here
|
|
}
|
|
|
|
# Define the path to the output CBZ file
|
|
output_path = PARENT / "output.cbz"
|
|
|
|
# Create an instance of the Helper class
|
|
helper = Helper(metadata)
|
|
|
|
# Create the CBZ file
|
|
helper.create_cbz(output_path)
|
|
````
|
|
|
|
For more information on how to use PyCBZHelper, please refer to
|
|
the [documentation](https://github.com/hyugogirubato/pycbzhelper/blob/main/docs/schema).
|
|
|
|
### Exceptions
|
|
|
|
The following exceptions can be raised by PyCBZHelper:
|
|
|
|
- `InvalidKeyValue`: Raised when a key value is invalid.
|
|
- `MissingPageFile`: Raised when no page files are available.
|
|
- `InvalidFileExtension`: Raised when an invalid file extension is used.
|
|
- `FileNotFound`: Raised when the specified source file is not found.
|
|
|
|
### License
|
|
|
|
This project is licensed under the [GPL v3 License](https://github.com/hyugogirubato/pycbzhelper/blob/main/LICENSE).
|