Compare commits

...
81 Commits
Author SHA1 Message Date
hyugogirubato c045c548de release v3.4.4 2025-08-31 21:21:53 +02:00
hyugogirubato 7355e5edc0 Merge pull request #23 from hyugogirubato/dependabot/github_actions/actions/checkout-5
Bump actions/checkout from 4 to 5
2025-08-31 21:14:36 +02:00
hyugogirubato 5eee972d75 Merge pull request #22 from tssujt/single
Fix ComicInfo XML parsing for single page comic
2025-08-31 21:14:07 +02:00
dependabot[bot] 3604a4e98f Bump actions/checkout from 4 to 5
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-18 23:05:20 +00:00
tssujt 19c1b01ea6 fix ComicInfo XML parsing for single page comic 2025-08-01 14:27:05 +08:00
hyugogirubato 7e599a1adb release v3.4.2 2025-07-26 17:21:02 +02:00
hyugogirubato 312eb2da13 Merge pull request #21 from hyugogirubato/dependabot/pip/pytest-gte-7.4.0-and-lt-9.0.0
Update pytest requirement from >=7.4.0,<8.0.0 to >=7.4.0,<9.0.0
2025-07-26 17:19:39 +02:00
hyugogirubato b7d1b631b9 fixing typo 2025-07-26 17:17:49 +02:00
hyugogirubato fe43024656 format 2025-07-26 17:17:28 +02:00
hyugogirubato 58a5256dc1 moved example to test dir 2025-07-26 17:17:13 +02:00
dependabot[bot] 7d0f004345 Update pytest requirement from >=7.4.0,<8.0.0 to >=7.4.0,<9.0.0
Updates the requirements on [pytest](https://github.com/pytest-dev/pytest) to permit the latest version.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/7.4.0...8.3.5)

---
updated-dependencies:
- dependency-name: pytest
  dependency-version: 8.3.5
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-26 14:45:37 +00:00
hyugogirubato 6aeabc2047 Merge pull request #20 from tssujt/tests
ci: Add testing framework setup
2025-07-26 16:44:30 +02:00
hyugogirubato 46b508adf8 release v3.4.0 2025-07-11 00:44:19 +02:00
hyugogirubato 6d771e3bf8 Merge pull request #19 from tssujt/typo
fix: Fix installation instructions
2025-07-11 00:34:17 +02:00
tssujt 0c4aa34f8f ci: Add testing framework setup 2025-07-10 12:08:28 +08:00
tssujt 48c99ba44f fix: Fix installation instructions 2025-07-10 10:56:23 +08:00
hyugogirubato 8af1c47e15 release v3.4.0 2025-07-09 23:42:10 +02:00
hyugogirubato 6aa6b0da21 fix markdown typo 2025-07-09 23:41:13 +02:00
hyugogirubato 526fee3617 update project date 2025-07-09 23:40:10 +02:00
hyugogirubato 6354c1d3bb add new contributor 2025-07-09 23:39:59 +02:00
hyugogirubato 3a80dfe47b add missing imports 2025-07-09 23:39:41 +02:00
hyugogirubato 58ef27f227 fix grammar 2025-07-09 23:39:28 +02:00
hyugogirubato 36b76f6d9e add missing repo reference 2025-07-09 23:39:15 +02:00
hyugogirubato 3c53f16d07 bump dep version 2025-07-09 23:39:00 +02:00
hyugogirubato 8161551ab6 specify complete py version 2025-07-09 23:38:47 +02:00
hyugogirubato 8ab1b37332 unified tk constants import 2025-07-09 23:38:24 +02:00
hyugogirubato 784f698044 update license date 2025-07-09 23:37:44 +02:00
hyugogirubato fc1e693e67 fix py 3.8 support 2025-07-09 23:37:34 +02:00
hyugogirubato 4d831f28a9 sort lib imports 2025-07-09 23:37:00 +02:00
hyugogirubato 195fca4370 apply git ignore 2025-07-09 23:00:48 +02:00
hyugogirubato 758e54fa4d Merge pull request #18 from tssujt/cbr
feat: Enhance support for CBR format
2025-07-09 22:56:53 +02:00
tssujt 7f1a0724e1 chore: Update document third-party licenses 2025-07-09 22:29:54 +08:00
tssujt f015d998e1 feat: Enhance support for CBR format 2025-07-09 22:29:53 +08:00
hyugogirubato 7d82752546 Merge pull request #17 from tssujt/pdf
Replace PyMuPDF with pypdf for PDF handling
2025-06-27 21:59:42 +02:00
tssujt e8e6eaf3ae Replace PyMuPDF with pypdf for PDF handling 2025-06-24 22:36:52 +08:00
hyugogirubato 4f777bc9bf Release v3.3.7 2025-01-04 12:51:54 +01:00
hyugogirubato c48d64cbe0 fix ctypes import for unix 2025-01-04 12:45:07 +01:00
hyugogirubato d195e25043 release v3.3.6 2024-12-22 12:05:07 +01:00
hyugogirubato 5fd7c019d1 sort imports 2024-12-22 12:04:33 +01:00
hyugogirubato c4169ebb84 more flexible dependencies 2024-12-22 12:03:39 +01:00
hyugogirubato a46bae2e2d skip poetry.lock 2024-12-22 12:00:36 +01:00
hyugogirubato 616b1eff8e fix deprecated datetime usage 2024-12-22 11:52:35 +01:00
hyugogirubato 27a313fe4c add missing name extract from zip unpack 2024-12-21 15:45:55 +01:00
hyugogirubato 72c14449fc option to skip page name rename 2024-12-21 15:37:14 +01:00
hyugogirubato 04feaa7027 Release v3.3.5 2024-07-22 19:52:31 +02:00
hyugogirubato 8b8069e38d Merge pull request #14 from gokender/fix-pathlib-import
Fix pathlib import in "utils.py"
2024-07-19 13:40:16 +02:00
gokender d357ad3e1d Fix pathlib import in "utils.py" 2024-07-19 10:24:37 +02:00
hyugogirubato b234a46e00 Release v3.3.4 2024-07-18 22:31:53 +02:00
hyugogirubato e6d77739e1 Merge remote-tracking branch 'origin/main' 2024-07-18 22:28:42 +02:00
hyugogirubato 0421d99c44 Fix invalid utc format 2024-07-18 22:28:26 +02:00
hyugogirubato 17084154a4 Remove invalid dict key 2024-07-18 22:27:03 +02:00
hyugogirubato cba561c2ec Update CHANGELOG.md 2024-07-18 22:20:31 +02:00
hyugogirubato 0b21040b95 Release v3.3.3 2024-07-18 22:12:15 +02:00
hyugogirubato f52e112de9 Fixed saving pages in XML 2024-07-18 22:11:24 +02:00
hyugogirubato 2435ca396d Update .gitignore 2024-07-18 22:11:01 +02:00
hyugogirubato 5bc82581a3 Removed MD5 display 2024-07-18 22:10:51 +02:00
hyugogirubato 188b2e0164 New information fields in the XML 2024-07-18 22:10:26 +02:00
hyugogirubato 04b77d5ff9 Updated ComicInfo.xsd 2024-07-18 22:10:13 +02:00
hyugogirubato 3f777d30d6 Fix jpg format key 2024-07-18 20:58:42 +02:00
hyugogirubato 6847e7f281 Added pdf support 2024-07-18 00:11:23 +02:00
hyugogirubato 15d7aaa094 Release v3.3.2 2024-07-18 00:04:25 +02:00
hyugogirubato 7800205e87 Release v3.3.2 2024-07-18 00:03:58 +02:00
hyugogirubato 963ecf9e6f Added zoom and scroll 2024-07-17 23:55:33 +02:00
hyugogirubato baee10d922 Format imports 2024-07-17 23:55:08 +02:00
hyugogirubato 140fd6c107 Format imports 2024-07-17 23:54:54 +02:00
hyugogirubato 7fceb86a7b Native extraction of ICO 2024-07-17 23:54:21 +02:00
hyugogirubato eec284a3ef New Contributors 2024-07-17 22:06:47 +02:00
hyugogirubato fe6d92229c Merge pull request #11 from gokender/fix-xmltodict-parse
Fix XML parsing for CBZ with one page
2024-07-17 22:03:38 +02:00
gokender 413f9d498e Fix XML parsing for CBZ with one page 2024-07-17 09:44:55 +02:00
hyugogirubato a90d9abf75 Simplification of the player icon 2024-07-16 22:45:27 +02:00
hyugogirubato 4fe38f0d5a Update CHANGELOG.md 2024-07-15 20:19:59 +02:00
hyugogirubato 153f5f79c5 Fixed lag when stretching player 2024-07-15 20:19:09 +02:00
hyugogirubato 0947e1904b New Contributors 2024-07-15 19:54:41 +02:00
hyugogirubato 7f1060fc30 Release v3.3.1 2024-07-15 19:51:54 +02:00
hyugogirubato df54489eef Add from_pdf method 2024-07-15 19:45:38 +02:00
hyugogirubato 68e843af63 Change quit keyboard shortcut to allow clipboard 2024-07-15 19:19:36 +02:00
hyugogirubato 4b2c47b4b8 Fix minimum player dimensions 2024-07-15 19:18:26 +02:00
hyugogirubato 74a6a0e9b6 Fix player border margin 2024-07-15 19:12:22 +02:00
hyugogirubato 82e1764c2e Fix windows taskbar player icon 2024-07-15 19:05:13 +02:00
hyugogirubato f62a508d9a Merge pull request #9 from flolep2607/fix-linux-player
fix: cbzplayer icon  for linux
2024-07-15 18:55:00 +02:00
flolep2607 90abd137c5 fix: cbzplayer icon for linux 2024-07-14 20:26:05 +02:00
34 changed files with 1432 additions and 454 deletions
+11
View File
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
+27
View File
@@ -0,0 +1,27 @@
name: Tests
on: [ push, pull_request ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ]
steps:
- uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install poetry
poetry install --no-interaction --no-root --with dev
- name: Run tests with pytest
run: |
poetry run pytest tests/ -v --cov=cbz --cov-report=xml --cov-report=term-missing
+5 -2
View File
@@ -100,7 +100,7 @@ ipython_config.py
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
@@ -171,4 +171,7 @@ poetry.toml
pyrightconfig.json
### CBZ ###
.cbz
*.cbz
*.pdf
*.zip
*cbr
+144
View File
@@ -4,6 +4,139 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [3.4.3] - 2025-08-31
### Changed
- Bump actions/checkout from 4 to 5.
### Fixed
- Fix ComicInfo XML parsing for single page comic.
## [3.4.2] - 2025-07-26
### Added
- Adding CI tests.
## [3.4.1] - 2025-07-11
### Fixed
- Fix installation instructions.
## [3.4.0] - 2025-07-09
### Added
- Support for PDF files.
- Support for CBR (Comic Book RAR) files.
### Changed
- Replaced `PyMuPDF` with `pypdf` for PDF handling.
- Updated third-party license documentation for bundled libraries.
### New Contributors
- [tssujt](https://github.com/tssujt)
## [3.3.7] - 2025-01-04
### Fixed
- Import error on Unix systems for the comic player.
## [3.3.6] - 2024-12-22
### Added
- Option to not rename the name of image files loaded into pages.
### Fixed
- Removing deprecated datetime api for utcnow.
## [3.3.5] - 2024-07-22
### Fixed
- Fix `Path` import using `pathlib`.
## [3.3.4] - 2024-07-18
### Fixed
- Remove invalid dict key.
- Fix invalid utc format.
## [3.3.3] - 2024-07-18
### Added
- Reference links for XML schema.
- New information fields in the XML.
- Support PDF files via `cbzplayer` command.
### Changed
- Removed MD5 display in the player (irrelevant).
- The displayed size in the player now reflects the total size of all images.
- Simplified the closing XML `Page` tag.
- Sorted `Page` keys in order.
- Updated `ComicInfo.xsd` defining the CBZ standard.
### Fixed
- Fixed the `.jpg` constant preventing the use of certain images.
- Fixed memory error related to the `pack()` method cache.
- Fixed saving pages in XML to comply with the standard.
- Added missing mandatory keys in the XML.
## [3.3.2] - 2024-07-18
### Added
- Added zoom options for displaying images in the player.
- Added scroll functionality for image display in the player, especially useful when images are zoomed.
### Changed
- Set a default standard size.
### Fixed
- Fix lag when stretching player.
- Fix XML parsing for CBZ files with a single page.
- Fix image positioning within the player.
### New Contributors
- [gokender](https://github.com/gokender)
## [3.3.1] - 2024-07-15
### Added
- Added `from_pdf` method to convert `.pdf` files to `.cbz`.
### Changed
- Set a default standard size.
- Changed a keyboard shortcut that prevented copying information.
### Fixed
- Fixed the icon display for Linux in the player.
- Fixed the taskbar icon for Windows in the player.
- Fixed the player margins.
- Automatically detect the player size based on the smallest image.
### New Contributors
- [flolep2607](https://github.com/flolep2607)
## [3.3.0] - 2024-07-14
### Added
@@ -82,6 +215,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Initial release.
[3.4.3]: https://github.com/hyugogirubato/cbz/releases/tag/v3.4.3
[3.4.2]: https://github.com/hyugogirubato/cbz/releases/tag/v3.4.2
[3.4.1]: https://github.com/hyugogirubato/cbz/releases/tag/v3.4.1
[3.4.0]: https://github.com/hyugogirubato/cbz/releases/tag/v3.4.0
[3.3.7]: https://github.com/hyugogirubato/cbz/releases/tag/v3.3.7
[3.3.6]: https://github.com/hyugogirubato/cbz/releases/tag/v3.3.6
[3.3.5]: https://github.com/hyugogirubato/cbz/releases/tag/v3.3.5
[3.3.4]: https://github.com/hyugogirubato/cbz/releases/tag/v3.3.4
[3.3.3]: https://github.com/hyugogirubato/cbz/releases/tag/v3.3.3
[3.3.2]: https://github.com/hyugogirubato/cbz/releases/tag/v3.3.2
[3.3.1]: https://github.com/hyugogirubato/cbz/releases/tag/v3.3.1
[3.3.0]: https://github.com/hyugogirubato/cbz/releases/tag/v3.3.0
[3.2.0]: https://github.com/hyugogirubato/cbz/releases/tag/v3.2.0
[3.1.2]: https://github.com/hyugogirubato/cbz/releases/tag/v3.1.2
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2024 hyugogirubato
Copyright (c) 2025 hyugogirubato
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+75 -11
View File
@@ -1,6 +1,6 @@
# CBZ
CBZ is a Python library designed for creating, manipulating, and viewing comic book files in CBZ format. It offers a straightforward interface to pack comic pages into CBZ archives, extract metadata, and display comics using a built-in player.
CBZ is a Python library designed for creating, manipulating, and viewing comic book files in CBZ, CBR, and PDF formats. It offers a straightforward interface to pack comic pages into CBZ archives, extract metadata from CBZ and CBR files, and display comics using a built-in player.
## Features
@@ -8,13 +8,14 @@ CBZ is a Python library designed for creating, manipulating, and viewing comic b
- 📚 Pack images into CBZ format for comics and manga
- 📝 Extract and manage title, series, format, and more
- 🖼️ Handle comic pages with attributes like type and format
- 📦 Unpack CBZ files to retrieve comic information
- 🛠️ Built-in player for viewing CBZ comics
- 📦 Unpack CBZ and CBR files to retrieve comic information, or extract images from PDF files
- 🛠️ Built-in player for viewing CBZ, CBR, and PDF comics
- 📚 Full CBR (RAR) format support for reading existing archives
- ❤️ Fully Open-Source! Pull Requests Welcome
## Installation
Install KeyDive from PyPI using Poetry:
Install CBZ from PyPI using pip:
```shell
pip install cbz
@@ -73,7 +74,15 @@ if __name__ == '__main__':
## Player
CBZ includes a command-line player for viewing CBZ comic book files. Simply run cbzplayer <file> to launch the player with the specified CBZ file.
CBZ includes a command-line player for viewing comic book files in multiple formats. Simply run `cbzplayer <file>` to launch the player with the specified comic book file.
### Supported Formats
- **CBZ** (Comic Book ZIP) - Standard ZIP archives containing images and metadata
- **CBR** (Comic Book RAR) - RAR archives containing images and metadata
- **PDF** - Portable Document Format files with embedded images (images only, no metadata)
### Usage
````shell
usage: cbzplayer [-h] <file>
@@ -81,13 +90,37 @@ usage: cbzplayer [-h] <file>
Launch CBZ player with a comic book file
positional arguments:
<file> Path to the CBZ comic book file.
<file> Path to the CBZ, CBR, or PDF comic book file.
options:
-h, --help show this help message and exit
````
### Examples
```shell
# View a CBZ file
cbzplayer my_comic.cbz
# View a CBR file
cbzplayer my_comic.cbr
# View a PDF file
cbzplayer my_comic.pdf
```
### Requirements for CBR Support
CBR file support requires:
- The `rarfile` Python package (automatically installed with CBZ)
- An external RAR extraction tool such as:
- `unrar` (recommended) - Available in most package managers
- `rar` - Commercial RAR archiver
- `7zip` - Free alternative with RAR support
For installation instructions and compatibility details, see the [rarfile documentation](https://github.com/markokr/rarfile).
## Detailed Usage
### Creating a ComicInfo Object
@@ -96,6 +129,7 @@ The `ComicInfo` class represents a comic book with metadata and pages. It suppor
```python
from cbz.comic import ComicInfo
from cbz.constants import PageType, YesNo, Manga, AgeRating, Format
from cbz.page import PageInfo
# Example usage:
@@ -135,27 +169,57 @@ Pack the comic into a CBZ file format:
cbz_content = comic.pack()
```
### Unpacking from CBZ
### Loading from Different Formats
Load a comic from an existing CBZ file:
Load a comic from an existing CBZ file (with metadata):
```python
comic_from_cbz = ComicInfo.from_cbz('/path/to/your_comic.cbz')
```
Load a comic from an existing CBR file (with metadata):
```python
comic_from_cbr = ComicInfo.from_cbr('/path/to/your_comic.cbr')
```
Load a comic from a PDF file (images only, no metadata):
```python
comic_from_pdf = ComicInfo.from_pdf('/path/to/your_comic.pdf')
```
**Notes**:
- CBR support requires an external RAR extraction tool. For detailed compatibility information and advanced configuration, see the [rarfile documentation](https://github.com/markokr/rarfile).
- PDF files only provide image content; comic metadata (title, series, etc.) is not available from PDF files.
## Contributors
<a href="https://github.com/hyugogirubato"><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/65763543?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="hyugogirubato"/></a>
<a href="https://github.com/piskunqa"><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/38443069?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="piskunqa"/></a>
<a href="https://github.com/OleskiiPyskun"><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/75667382?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="OleskiiPyskun"/></a>
<a href="https://github.com/tssujt"><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/17313425?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="tssujt"/></a>
<a href="https://github.com/gokender"><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/3709740?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="gokender"/></a>
<a href="https://github.com/domenicoblanco"><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/9018104?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="domenicoblanco"/></a>
<a href="https://github.com/RivMt"><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/40086827?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="RivMt"/></a>
<a href="https://github.com/flolep2607"><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/24566964?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="flolep2607"/></a>
## Licensing
This software is licensed under the terms of [MIT License](https://github.com/hyugogirubato/cbz/blob/main/LICENSE).
You can find a copy of the license in the LICENSE file in the root folder.
* * *
### Third-Party Licenses
© hyugogirubato 2024
This project uses the following third-party libraries:
- **[langcodes](https://pypi.org/project/langcodes/)** - MIT License
- **[Pillow](https://pypi.org/project/Pillow/)** - HPND License
- **[pypdf](https://pypi.org/project/pypdf/)** - BSD License
- **[rarfile](https://pypi.org/project/rarfile/)** - ISC License
- **[xmltodict](https://pypi.org/project/xmltodict/)** - MIT License
---
© hyugogirubato 2025
+9 -3
View File
@@ -8,7 +8,7 @@ from cbz.comic import ComicInfo
def main() -> None:
# Parse command-line arguments
parser = argparse.ArgumentParser(description='Launch CBZ player with a comic book file')
parser.add_argument('comic_path', type=Path, metavar='<file>', help='Path to the CBZ comic book file.')
parser.add_argument('comic_path', type=Path, metavar='<file>', help='Path to the CBZ, CBR, or PDF comic book file.')
args = parser.parse_args()
# Validate the provided path
@@ -17,9 +17,15 @@ def main() -> None:
print(f'Error: The file "{comic_path}" does not exist or is not a valid file.')
exit(1)
# Create ComicInfo object from CBZ file
# Create ComicInfo object from comic file
try:
comic_info = ComicInfo.from_cbz(path=comic_path)
if comic_path.suffix == '.pdf':
comic_info = ComicInfo.from_pdf(comic_path)
elif comic_path.suffix == '.cbr':
comic_info = ComicInfo.from_cbr(comic_path)
else:
comic_info = ComicInfo.from_cbz(comic_path)
# Launch the CBZ player
comic_info.show()
except Exception as e:
+136 -30
View File
@@ -1,14 +1,18 @@
from __future__ import annotations
import zipfile
from datetime import datetime, timezone
from enum import Enum
from io import BytesIO
from typing import Union
from functools import cache
from typing import Union, List
from pathlib import Path
import rarfile
import xmltodict
from pypdf import PdfReader
from cbz.constants import XML_NAME, COMIC_FIELDS, IMAGE_FORMAT, PAGE_FIELDS
from cbz.models import ComicModel
from cbz.page import PageInfo
@@ -20,27 +24,27 @@ class ComicInfo(ComicModel):
ComicInfo class that represents the comic book information and pages.
"""
def __init__(self, pages: list[PageInfo], **kwargs):
def __init__(self, pages: List[PageInfo], **kwargs):
"""
Initialize the ComicInfo instance with pages and additional attributes.
Args:
pages (list[PageInfo]): List of PageInfo objects representing the comic pages.
pages (List[PageInfo]): List of PageInfo objects representing the comic pages.
**kwargs: Additional attributes for the comic.
Attributes:
pages (list[PageInfo]): Stores the comic pages.
pages (List[PageInfo]): Stores the comic pages.
"""
super(ComicInfo, self).__init__(**kwargs)
self.pages = pages
@classmethod
def from_pages(cls, pages: list[PageInfo], **kwargs) -> ComicInfo:
def from_pages(cls, pages: List[PageInfo], **kwargs) -> ComicInfo:
"""
Create a ComicInfo instance from pages and additional attributes.
Args:
pages (list[PageInfo]): List of PageInfo objects representing the comic pages.
pages (List[PageInfo]): List of PageInfo objects representing the comic pages.
**kwargs: Additional attributes for the comic.
Returns:
@@ -64,21 +68,66 @@ class ComicInfo(ComicModel):
"""
if not isinstance(path, (Path, str)):
raise ValueError(f'Expecting Path object or path string, got {path!r}')
return cls.__unpack(path)
return cls.__unpack_zip(Path(path))
@staticmethod
def __unpack(path: Path) -> ComicInfo:
@classmethod
def from_cbr(cls, path: Union[Path, str]) -> ComicInfo:
"""
Unpack a CBZ file and create a ComicInfo instance.
Create a ComicInfo instance from a CBR file.
Args:
path (Path): Path to the CBZ file.
path (Union[Path, str]): Path to the CBR file.
Returns:
ComicInfo: An instance of ComicInfo.
Raises:
ValueError: If the provided path is not a Path object or a string.
"""
if not isinstance(path, (Path, str)):
raise ValueError(f'Expecting Path object or path string, got {path!r}')
return cls.__unpack_rar(Path(path))
@classmethod
def from_pdf(cls, path: Union[Path, str]) -> ComicInfo:
"""
Create a ComicInfo instance from a PDF file.
Args:
path (Union[Path, str]): Path to the PDF file.
Returns:
ComicInfo: An instance of ComicInfo.
Raises:
ValueError: If the provided path is not a Path object or a string.
"""
if not isinstance(path, (Path, str)):
raise ValueError(f'Expecting Path object or path string, got {path!r}')
return cls.__unpack_pdf(Path(path))
@staticmethod
def __unpack_pdf(path: Path) -> ComicInfo:
"""
Unpack a PDF file and create a ComicInfo instance.
Args:
path (Path): Path to the PDF file.
Returns:
ComicInfo: An instance of ComicInfo.
"""
pages: List[PageInfo] = []
reader = PdfReader(path)
for page in reader.pages:
for image in page.images:
pages.append(PageInfo.loads(data=image.data))
def __info(items: dict, fields: dict) -> dict:
assert pages, 'No valid images present in file'
return ComicInfo.from_pages(pages=pages)
@staticmethod
def __extract_info(items: dict, fields: dict) -> dict:
"""
Extract and convert field information from the provided items and fields.
@@ -95,38 +144,76 @@ class ComicInfo(ComicModel):
content[key] = field_type(items[field_key])
return content
pages = []
@staticmethod
def __process_archive(archive_file: Union[zipfile.ZipFile, rarfile.RarFile]) -> ComicInfo:
"""
Common logic for processing archive files (CBZ/CBR).
with zipfile.ZipFile(path, 'r', zipfile.ZIP_STORED) as zf:
names = zf.namelist()
Args:
archive_file (Union[ZipFile, RarFile]): Archive file object (ZipFile or RarFile)
Returns:
ComicInfo: An instance of ComicInfo.
"""
pages = []
names = archive_file.namelist()
comic_info = {}
if XML_NAME in names:
with zf.open(XML_NAME, 'r') as f:
comic_info = xmltodict.parse(f.read()).get('ComicInfo', {})
with archive_file.open(XML_NAME, 'r') as f:
comic_info = xmltodict.parse(f.read(), force_list=('Page',)).get('ComicInfo', {})
names.remove(XML_NAME)
comic = __info(
comic = ComicInfo.__extract_info(
items=comic_info,
fields=COMIC_FIELDS
)
pages_info = comic_info.get('Pages', [])
pages_info = comic_info.get('Pages', {}).get('Page', [])
for i, name in enumerate(names):
suffix = Path(name).suffix
if suffix:
assert suffix in IMAGE_FORMAT, f'Unsupported image format: {suffix}'
with zf.open(name, 'r') as f:
with archive_file.open(name, 'r') as f:
page_info = {}
if i < len(pages_info):
page_info = __info(
page_info = ComicInfo.__extract_info(
items=pages_info[i],
fields=PAGE_FIELDS
)
page_info['name'] = Path(name).name
pages.append(PageInfo.loads(data=f.read(), **page_info))
return ComicInfo.from_pages(pages=pages, **comic)
@staticmethod
def __unpack_rar(path: Path) -> ComicInfo:
"""
Unpack a CBR file and create a ComicInfo instance.
Args:
path (Path): Path to the CBR file.
Returns:
ComicInfo: An instance of ComicInfo.
"""
with rarfile.RarFile(path, 'r') as rf:
return ComicInfo.__process_archive(rf)
@staticmethod
def __unpack_zip(path: Path) -> ComicInfo:
"""
Unpack a CBZ file and create a ComicInfo instance.
Args:
path (Path): Path to the CBZ file.
Returns:
ComicInfo: An instance of ComicInfo.
"""
with zipfile.ZipFile(path, 'r', zipfile.ZIP_STORED) as zf:
return ComicInfo.__process_archive(zf)
def get_info(self) -> dict:
"""
Get the comic information as a dictionary.
@@ -157,31 +244,50 @@ class ComicInfo(ComicModel):
items={k: v for k, v in self.__dict__.items() if not k.startswith('_')},
fields=COMIC_FIELDS)
comic_info['Pages'] = []
for page in self.pages:
comic_pages = []
for i, page in enumerate(self.pages):
page_info = __info(
items={k: v for k, v in page.__dict__.items() if not k.startswith('_')},
fields=PAGE_FIELDS)
comic_info['Pages'].append(page_info)
page_info['@Image'] = i
comic_pages.append(dict(sorted(page_info.items())))
# https://github.com/anansi-project/rfcs/issues/3#issuecomment-671631676
utcnow = datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%S.%f')[:-3] + 'Z'
comic_info.update({
'@xmlns:xsd': 'http://www.w3.org/2001/XMLSchema',
'@xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance',
'FileSize': comic_info.get('FileSize', sum(p.image_size for p in self.pages)),
'FileCreationTime': comic_info.get('FileCreationTime', utcnow),
'FileModifiedTime': comic_info.get('FileModifiedTime', utcnow),
'PageCount': len(self.pages),
'Pages': {'Page': comic_pages}
})
return comic_info
@cache
def pack(self) -> bytes:
def pack(self, rename: bool = True) -> bytes:
"""
Pack the comic information and pages into a CBZ file format.
Args:
rename (bool): Whether to rename pages to a sequential format (e.g., 'page-001.jpg').
Returns:
bytes: Bytes representing the packed CBZ file.
"""
zip_buffer = BytesIO()
with zipfile.ZipFile(zip_buffer, 'w', zipfile.ZIP_STORED) as zf:
content = xmltodict.unparse({'ComicInfo': self.get_info()}, pretty=True)
zf.writestr(
XML_NAME,
xmltodict.unparse({'ComicInfo': self.get_info()}, pretty=True).encode('utf-8')
content.replace('></Page>', ' />').encode('utf-8')
)
for i, page in enumerate(self.pages):
zf.writestr(f'page-{i + 1:03d}{page.suffix}', page.content)
name = page.name
# If the page does not have a name or renaming is enabled, generate a sequential name for the page.
if not name or rename:
name = f'page-{i + 1:03d}{page.suffix}'
zf.writestr(name, page.content)
packed = zip_buffer.getvalue()
zip_buffer.close()
+16 -8
View File
@@ -169,15 +169,23 @@ COMIC_FIELDS = {
'main_character_or_team': ('MainCharacterOrTeam', str),
'review': ('Review', str),
'language_iso': ('LanguageISO', LanguageISO),
'community_rating': ('CommunityRating', Rating)
'community_rating': ('CommunityRating', Rating),
'added': ('Added', str),
'released': ('Released', str),
'file_size': ('FileSize', int),
'file_modified_time': ('FileModifiedTime', str),
'file_creation_time': ('FileCreationTime', str),
'book_price': ('BookPrice', str),
'custom_values_store': ('CustomValuesStore', str)
}
PAGE_FIELDS = {
'type': ('Type', PageType),
'double': ('DoublePage', bool),
'key': ('Key', str),
'bookmark': ('Bookmark', str),
'image_size': ('ImageSize', int),
'image_width': ('ImageWidth', int),
'image_height': ('ImageHeight', int)
'image': ('@Image', int),
'type': ('@Type', PageType),
'double': ('@DoublePage', bool),
'key': ('@Key', str),
'bookmark': ('@Bookmark', str),
'image_size': ('@ImageSize', int),
'image_width': ('@ImageWidth', int),
'image_height': ('@ImageHeight', int)
}
+8
View File
@@ -102,6 +102,13 @@ class ComicModel(BaseModel):
review: str
language_iso: LanguageISO
community_rating: Rating
added: str
released: str
file_size: int
file_modified_time: str
file_creation_time: str
book_price: str
custom_values_store: str
def __init__(self, **kwargs):
"""
@@ -125,6 +132,7 @@ class PageModel(BaseModel):
image_width: int
image_height: int
suffix: str
name: str
__content: bytes
def __init__(self, **kwargs):
+9 -4
View File
@@ -1,10 +1,11 @@
from __future__ import annotations
import base64
from io import BytesIO
from typing import Union
from io import BytesIO
from typing import Union, Optional
from pathlib import Path
from PIL import Image
from cbz.constants import IMAGE_FORMAT
@@ -16,15 +17,17 @@ class PageInfo(PageModel):
Model for representing comic book pages with additional content handling capabilities.
"""
def __init__(self, content: bytes, **kwargs):
def __init__(self, content: bytes, name: Optional[str] = None, **kwargs):
"""
Initializes a PageInfo instance.
Args:
content (bytes): The content of the page in bytes.
name (Optional[str]): The name of the page (default is None).
**kwargs: Additional keyword arguments passed to the base class initializer.
"""
super(PageInfo, self).__init__(**kwargs)
self.name = name
self.content = content
@property
@@ -92,7 +95,9 @@ class PageInfo(PageModel):
"""
if not isinstance(path, (Path, str)):
raise ValueError(f'Expecting Path object or path string, got {path!r}')
with Path(path).open(mode='rb') as f:
path = Path(path)
with path.open(mode='rb') as f:
kwargs.setdefault('name', path.name)
return cls(f.read(), **kwargs)
def show(self) -> None:
+185 -43
View File
@@ -1,15 +1,23 @@
import hashlib
import os
import tkinter as tk
from io import BytesIO
from tkinter import ttk
from tkinter.constants import DISABLED, NORMAL
from pathlib import Path
try:
from ctypes import windll
except ImportError:
windll = None # windll is not available on this platform
from PIL import Image, ImageTk
from pathlib import Path
from cbz.comic import ComicInfo
from cbz.page import PageInfo
from cbz.utils import readable_size
from cbz.utils import readable_size, ico_to_png
PARENT = Path(__file__).parent
CTRL_KEY = 0x4 # Constant for Ctrl key
class Player:
@@ -33,6 +41,10 @@ class Player:
page_index_label (ttk.Label): Label showing the current page index.
previous_width (int): Previous width of the main window.
previous_height (int): Previous height of the main window.
resize_timer (int or None): Timer ID for handling window resize delay.
max_zoom_factor (float or None): Maximum allowable zoom factor based on canvas size and image dimensions.
zoom_factor (float or None): Current zoom factor for image display.
img_original (PIL.Image.Image or None): Placeholder for the original image to be displayed.
"""
def __init__(self, comic_info: ComicInfo):
@@ -44,6 +56,9 @@ class Player:
"""
self.comic_info = comic_info
self.current_page = -1 # Track the current page index
self.max_zoom_factor = None # Maximum allowable zoom factor based on canvas size and image dimensions
self.zoom_factor = None # Initial zoom factor (None means no zoom initially)
self.img_original = None # Placeholder for the original image
# Initialize tkinter window
self.root = tk.Tk()
@@ -52,8 +67,8 @@ class Player:
# Set initial window size
self.root.geometry(self._get_initial_geometry())
# Set window icon
self.root.iconbitmap(Path(__file__).parent / 'cbz.ico')
# Set the application icon
self._set_icon()
# Create main frame for content
self.main_frame = ttk.Frame(self.root)
@@ -79,6 +94,23 @@ class Player:
self.previous_width = self.root.winfo_width()
self.previous_height = self.root.winfo_height()
# Initialize resize timer
self.resize_timer = None
def _set_icon(self) -> None:
"""
Set the application icon for the window.
"""
image_path = PARENT / 'cbz.ico'
if os.name == 'nt':
# Set the application ID and icon on Windows
windll.shell32.SetCurrentProcessExplicitAppUserModelID('cbz.player')
self.root.iconbitmap(image_path)
else:
# Convert ICO to PNG for other operating systems
image = ico_to_png(image_path)
self.root.iconphoto(True, tk.PhotoImage(data=image.getvalue()))
def _get_window_title(self) -> str:
"""
Get the window title based on the comic series and title.
@@ -87,7 +119,7 @@ class Player:
str: Window title.
"""
if self.comic_info.series and self.comic_info.title:
return f"{self.comic_info.series} - {self.comic_info.title}"
return f'{self.comic_info.series} - {self.comic_info.title}'
return self.comic_info.title or self.__class__.__name__
def _get_initial_geometry(self) -> str:
@@ -105,21 +137,37 @@ class Player:
available_width = self.root.winfo_screenwidth() - 2 * margin_width
available_height = self.root.winfo_screenheight() - 2 * margin_height
# Default screen size for initialization
screen_width = int(available_height * 0.63)
screen_height = int(available_height)
# Calculate scaling factors for width and height
if self.comic_info.pages:
first_page = self.comic_info.pages[0]
scale_width = available_width / first_page.image_width
scale_height = available_height / first_page.image_height
# Get the minimum dimensions from all pages
image_width = self.comic_info.pages[0].image_width
image_height = self.comic_info.pages[0].image_height
for page in self.comic_info.pages[1:]:
if page.image_width <= image_width and page.image_height <= image_height:
image_width = page.image_width
image_height = page.image_height
scale_width = available_width / image_width
scale_height = available_height / image_height
# Choose the smaller scaling factor to maintain proportions
scale_factor = min(scale_width, scale_height)
# Calculate new dimensions
initial_width = int(first_page.image_width * scale_factor)
initial_height = int(first_page.image_height * scale_factor)
initial_width = int(image_width * scale_factor * 0.94)
initial_height = int(image_height * scale_factor)
else:
initial_width = int(available_width)
initial_height = int(available_height)
# If no pages are available, default to screen size
initial_width = screen_width
initial_height = screen_height
# Ensure that the window's initial width is at least 50% of the screen width
if 100 / screen_width * initial_width < 50.0:
initial_width = screen_width
# Calculate initial position to center the window on the screen
x = self.root.winfo_screenwidth() // 2 - initial_width // 2
@@ -158,9 +206,9 @@ class Player:
self.summary_text = tk.Text(self.canvas, wrap=tk.WORD, bg='white', bd=0, padx=10, pady=10)
self.summary_text.tag_configure('bold', font=('Arial', 13, 'bold'))
self.summary_text.tag_configure('normal', font=('Arial', 12), lmargin1=10, lmargin2=10)
self.summary_text.config(state=DISABLED)
self.summary_text.config(state=tk.DISABLED)
def show_page(self):
def show_page(self) -> None:
"""
Display the current page content (either summary or image).
"""
@@ -174,8 +222,8 @@ class Player:
self._show_image_page()
# Update navigation button states based on current page index
self.prev_button.config(state=DISABLED if self.current_page == -1 else NORMAL)
self.next_button.config(state=DISABLED if self.current_page + 1 == len(self.comic_info.pages) else NORMAL)
self.prev_button.config(state=tk.DISABLED if self.current_page == -1 else tk.NORMAL)
self.next_button.config(state=tk.DISABLED if self.current_page + 1 == len(self.comic_info.pages) else tk.NORMAL)
# Update page index label text
self.page_index_label.config(text=f'{self.current_page + 1}/{len(self.comic_info.pages)}')
@@ -189,19 +237,18 @@ class Player:
# Display summary for the first page
infos = self.comic_info.get_info()
packed = self.comic_info.pack()
infos['Pages'] = len(infos['Pages'])
infos['Size'] = readable_size(len(packed), decimal=2)
infos['MD5'] = hashlib.md5(packed).hexdigest()
self.summary_text.config(state=NORMAL)
self.summary_text.config(state=tk.NORMAL)
self.summary_text.delete('1.0', tk.END)
for key, value in infos.items():
if not (key.startswith('@') or key == 'Pages'):
if key == 'FileSize':
value = readable_size(value)
self.summary_text.insert(tk.END, f'{key}\n', 'bold')
self.summary_text.insert(tk.END, f'{value}\n\n', 'normal')
self.summary_text.config(state=DISABLED)
self.summary_text.config(state=tk.DISABLED)
self.summary_text.place(relwidth=1, relheight=1)
def _show_image_page(self) -> None:
@@ -213,26 +260,40 @@ class Player:
# Display image centered on canvas
page: PageInfo = self.comic_info.pages[self.current_page]
img = Image.open(BytesIO(page.content))
self.img_original = Image.open(BytesIO(page.content))
self._display_image()
# Calculate scaling factor
scale_width = self.canvas.winfo_width() / img.width
scale_height = self.canvas.winfo_height() / img.height
scale_factor = min(scale_width, scale_height)
def _display_image(self) -> None:
"""
Display the image on the canvas with zooming capabilities.
"""
# Check if zoom factor is not set; initialize zoom factors
if not self.zoom_factor:
# Determine maximum zoom factor based on canvas size and original image size
self.max_zoom_factor = min(
self.canvas.winfo_width() / self.img_original.width,
self.canvas.winfo_height() / self.img_original.height
)
self.zoom_factor = self.max_zoom_factor
# Resize image
new_width = int(img.width * scale_factor)
new_height = int(img.height * scale_factor)
img = img.resize((new_width, new_height), Image.LANCZOS)
# Calculate new dimensions of the image based on current zoom factor
new_width = int(self.img_original.width * self.zoom_factor)
new_height = int(self.img_original.height * self.zoom_factor)
img = self.img_original.resize((new_width, new_height), Image.Resampling.LANCZOS)
# Set image on canvas
# Convert the resized image to PhotoImage format compatible with Tkinter canvas
self.canvas.image = ImageTk.PhotoImage(img)
# Calculate coordinates to center the image on the canvas
x = (self.canvas.winfo_width() - new_width) // 2
y = (self.canvas.winfo_height() - new_height) // 2
# Calculate the position to center the image on the canvas
x = max(0, (self.canvas.winfo_width() - new_width) // 2)
y = max(0, (self.canvas.winfo_height() - new_height) // 2)
self.canvas.create_image(x, y, anchor=tk.NW, image=self.canvas.image)
# Configure the scroll region of the canvas to allow scrolling if image is larger than canvas
canvas_width = max(new_width, self.canvas.winfo_width())
canvas_height = max(new_height, self.canvas.winfo_height())
self.canvas.config(scrollregion=(0, 0, canvas_width, canvas_height))
def _bind_keys(self) -> None:
"""
Bind keys for navigation (left/right arrow keys) and window events.
@@ -241,17 +302,77 @@ class Player:
self.root.bind('<Left>', lambda event: self.on_previous())
self.root.bind('<Right>', lambda event: self.one_next())
# Bind Ctrl+C to exit application
self.root.bind('<Control-c>', lambda event: self.root.quit())
# Bind Ctrl+Q to exit application
self.root.bind('<Control-q>', lambda event: self.root.quit())
# Bind the configure event to handle window resize
self.root.bind('<Configure>', lambda event: self.on_window(event))
# Bind mouse wheel events for zooming
self.root.bind('<Control-MouseWheel>', self.on_zoom)
self.canvas.bind_all("<MouseWheel>", self._on_mouse_wheel)
self.canvas.bind_all("<Shift-MouseWheel>", self._on_shift_mouse_wheel)
# Bind zoom controls to keyboard keys
self.root.bind('<KeyPress-plus>', lambda event: self.on_zoom_key(True))
self.root.bind('<KeyPress-minus>', lambda event: self.on_zoom_key(False))
def on_zoom_key(self, positive: bool) -> None:
"""
Handle zooming triggered by keyboard keys ('+' for zoom in, '-' for zoom out).
Args:
positive (bool): True for zoom in, False for zoom out.
"""
# Create a synthetic event object to simulate mouse wheel scrolling
event = tk.Event()
event.delta = 120 if positive else -120
self.on_zoom(event)
def on_zoom(self, event) -> None:
"""
Handle zooming using Ctrl + Mouse Wheel.
"""
if self.current_page == -1: return
# Adjust zoom factor based on mouse wheel direction
if event.delta > 0:
# Increase zoom factor by 10% for zoom in
self.zoom_factor *= 1.1
elif event.delta < 0:
# Decrease zoom factor by 10% for zoom out
self.zoom_factor /= 1.1
# Ensure the zoom-out factor doesn't go below the original image size
min_zoom_factor = min(
self.canvas.winfo_width() / self.img_original.width,
self.canvas.winfo_height() / self.img_original.height
)
if self.zoom_factor < min_zoom_factor:
self.zoom_factor = min_zoom_factor
# Update the displayed image with the new zoom factor
self._display_image()
def _on_mouse_wheel(self, event) -> None:
"""
Handle vertical scroll using Mouse Wheel.
"""
if self.current_page == -1 or (event.state & CTRL_KEY): return
self.canvas.yview_scroll(int(-1 * (event.delta / 120)), "units")
def _on_shift_mouse_wheel(self, event) -> None:
"""
Handle horizontal scroll using Shift + Mouse Wheel.
"""
if self.current_page == -1 or (event.state & CTRL_KEY): return
self.canvas.xview_scroll(int(-1 * (event.delta / 120)), "units")
def on_previous(self) -> None:
"""
Navigate to the previous page.
"""
if self.current_page > -1:
if self.current_page == -1: return
self.current_page -= 1
self.show_page()
@@ -271,8 +392,29 @@ class Player:
if event.width != self.previous_width or event.height != self.previous_height:
self.previous_width = event.width
self.previous_height = event.height
# Update the image display on canvas when the window size changes
self.show_page()
# Cancel any existing resize timer
if self.resize_timer:
self.root.after_cancel(self.resize_timer)
# Set a new timer to call show_page after a delay
self.resize_timer = self.root.after(200, self._on_resize)
def _on_resize(self) -> None:
"""
Handle resizing of the window and adjust image display accordingly.
"""
if self.current_page == -1: return
# Reset zoom factor to None if it's equal to the maximum zoom factor
if self.zoom_factor == self.max_zoom_factor:
self.zoom_factor = None
# Update the displayed image with the current zoom factor
self._display_image()
# Reset the resize timer
self.resize_timer = None
def run(self) -> None:
"""
+31 -1
View File
@@ -1,9 +1,14 @@
from enum import Enum
from io import BytesIO
from pathlib import Path
from PIL import Image
from PIL.IcoImagePlugin import IcoFile
def default_attr(value: any) -> any:
"""
Provides a default value based on the expected type of an attribute.
Provides a default value based on the expected type of attribute.
Args:
value (any): Expected type or class of the attribute.
@@ -77,3 +82,28 @@ def readable_size(size: int, decimal: int = 2) -> str:
if size < 1024:
return f'{size:.{decimal}f} {unit}'
size /= 1024
def ico_to_png(path: Path) -> BytesIO:
"""
Converts the largest icon in an ICO file to PNG format.
Args:
path (Path): Path to the ICO file.
Returns:
BytesIO: In-memory PNG file of the largest icon.
"""
# Open the ICO file and read its content
image = Image.open(BytesIO(path.read_bytes()))
assert image.format == 'ICO', 'Unsupported image format'
# Get the ICO file object and find the largest icon size
icon: IcoFile = image.ico
max_size = max(icon.sizes(), key=lambda x: x[0] + x[1])
largest_image = icon.getimage(size=max_size)
# Save the largest icon as PNG format to an in-memory BytesIO object
content = BytesIO()
largest_image.save(content, format='PNG')
return content
+51
View File
@@ -0,0 +1,51 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" viewBox="0 0 512 512">
<defs>
<clipPath id="clip-favicon">
<rect width="512" height="512"/>
</clipPath>
</defs>
<g id="favicon" clip-path="url(#clip-favicon)">
<g id="clipboard" transform="translate(-23.514 -24.026)">
<g id="_000000ff" data-name="#000000ff" transform="translate(23.966 24.026)">
<path id="Path_1" data-name="Path 1" d="M169.389,31.663c.738-3.359,3.051-6.52,6.531-7.335,4.846-1.377,8.954,2.28,12.808,4.6,43.612,29.3,76.068,74.56,90.341,125.088.363,1.817,1.278-.463,1.333-1.046,8.733-27.819,26.068-52.313,47.1-72.225,24.086-22.775,52.72-40.4,83.073-53.491,3.579-1.344,7.148-3.491,11.1-3.15a8.832,8.832,0,0,1,7.511,7.577c1.6,8.767,2.963,17.588,4.5,26.366,15.154-5.4,30.3-10.87,45.573-15.914a8.733,8.733,0,0,1,10.87,4.692c4.78,10.628,9.251,21.41,13.976,32.071,5.991-3.106,11.861-6.454,17.885-9.493a8.785,8.785,0,0,1,11.267,2.5c1.6,2,1.718,4.648,1.762,7.093q-.033,159.185-.011,318.381c-.066,4.053.275,8.128-.275,12.159-.562,3.227-3.315,5.374-6.046,6.806Q429.13,469.256,329.709,522.4c-6.806,3.557-13.447,7.632-20.9,9.747a112.762,112.762,0,0,1-36.465,3.7c-11.322-.7-22.819-2.742-32.93-8.117q-102.72-54.7-205.43-109.482c-3.392-1.927-7.72-3.348-9.273-7.291-1.09-3.293-.628-6.839-.727-10.242q.1-161.415.044-322.842a8.992,8.992,0,0,1,5.33-8.844c2.941-1.388,6.322-.518,9.009,1.024,7.709,4.108,15.4,8.249,23.117,12.335,2.357-11.366,4.427-22.8,6.916-34.141.98-4.692,6.156-7.544,10.716-6.377,28.051,4.5,54.736,15.1,80.121,27.61q5.039-18.932,10.154-37.819M360.546,75.5c-19.714,14.736-37.8,32.4-50.176,53.844,30.143-29.229,67.7-49.5,106.509-64.758-.991-6.52-2.225-13-3.2-19.515A266.629,266.629,0,0,0,360.546,75.5M175.1,78.259C204.686,95.352,231.68,116.685,256,140.638c-14.482-37.236-39.615-70.661-72.39-93.656-3.018,10.374-5.628,20.87-8.5,31.278M83.761,60.616C81.845,70.782,79.719,80.9,77.737,91.057,134.059,120.947,190.259,151.09,246.57,181c8.48,3.106,17.632,3.976,26.575,4.725C237.4,142.268,193.211,105.088,142.164,80.9c-18.678-8.756-38.161-16.09-58.4-20.286m293.745,41.575a255.536,255.536,0,0,0-91.564,83.557c9.1-.848,18.447-1.674,27.037-4.945q87.737-46.867,175.529-93.59-5.617-12.885-11.178-25.782c-34.009,11.608-68.282,23.271-99.824,40.76M41.636,91.784c.055,103.579-.154,207.148.1,310.727q3.948,1.949,7.83,4.053c5.551,3.172,11.222,6.167,16.938,9.031v.165c1.905.98,3.811,1.971,5.694,2.974q81.608,43.563,163.238,87.06.05-152.66,0-305.32c-.011-1.828-.022-3.656-.044-5.474Q138.469,143.458,41.636,91.784M323.629,195.022c-.066,3.2-.077,6.4-.066,9.6q.033,150.595.022,301.2,93.866-49.84,187.577-99.945l-.055-.385c2.048-.936,4.1-1.905,6.156-2.852.308-103.6.044-207.225.132-310.837q-96.889,51.608-193.767,103.216m-70.507,5.991q-.1,137.049.011,274.1c12.974,1.806,26.178,2.654,39.251,1.355a119.414,119.414,0,0,0,13.557-1.586q-.017-137,0-274c-.925.187-2.753.551-3.667.738-12.148,1.6-24.416,2.533-36.652,1.289v-.33c-1.949-.154-3.9-.319-5.848-.485-2.225-.319-4.438-.694-6.652-1.079m-.033,291.74q-.033,11.085.011,22.17c2.709.793,5.441,1.531,8.15,2.346l4.284.661c10.385,1.189,21.1,1.4,31.344-.936a73.568,73.568,0,0,0,8.965-2.1c.2-7.357.055-14.714.1-22.059-4.042.352-8.106.584-12.1,1.311A214.472,214.472,0,0,1,253.09,492.753Z" transform="translate(-23.966 -24.026)"/>
<path id="Path_2" data-name="Path 2" d="M457.7,142.458c5.264-3.128,12.742,1.057,12.786,7.181.242,18.018.066,36.046.088,54.064a9.319,9.319,0,0,1-5.507,8.756q-67.318,35.7-134.659,71.322c-3.095,1.542-6.09,3.733-9.659,3.855a8.814,8.814,0,0,1-8.689-8.855c-.121-17.7-.044-35.4-.033-53.095a9.162,9.162,0,0,1,5.253-8.932q70.209-37.153,140.419-74.3M329.611,230.167c.011,1.476.011,2.941.022,4.416-.033,9.945,0,19.89-.011,29.824Q388.8,233.1,447.937,201.731c1.641-.947,3.3-1.839,4.978-2.72.121-11.388.022-22.775.055-34.163Q391.3,197.524,329.611,230.167Z" transform="translate(5.217 -12.134)"/>
<path id="Path_3" data-name="Path 3" d="M253.906,212.509c5.419-2.148,11.905,2.445,11.663,8.271.132,53.954.022,107.919.055,161.883.374,4.251-2.313,8.623-6.564,9.637-5.308,1.619-11.245-2.918-11-8.469-.121-54-.022-108-.055-161.993A9.061,9.061,0,0,1,253.906,212.509Z" transform="translate(-1.269 -4.983)"/>
<path id="Path_4" data-name="Path 4" d="M253.861,384.521c5.408-2.17,11.916,2.39,11.707,8.2.143,8.48.033,16.971.044,25.463a9.075,9.075,0,0,1-5.892,9.35c-5.374,2.137-11.861-2.39-11.652-8.172q-.182-13.315-.011-26.641A8.733,8.733,0,0,1,253.861,384.521Z" transform="translate(-1.268 12.444)"/>
</g>
<g id="_fcf3e7ff" data-name="#fcf3e7ff" transform="translate(77.737 45.066)">
<path id="Path_5" data-name="Path 5" d="M334.2,73.56a266.629,266.629,0,0,1,53.128-30.43c.98,6.52,2.214,13,3.2,19.515C351.718,77.9,314.163,98.174,284.02,127.4,296.4,105.96,314.483,88.3,334.2,73.56Z" transform="translate(-51.388 -43.13)" fill="#fcf3e7"/>
<path id="Path_6" data-name="Path 6" d="M161.2,76.148c2.874-10.407,5.485-20.9,8.5-31.278,32.775,23,57.908,56.421,72.39,93.656C217.775,114.573,190.782,93.24,161.2,76.148Z" transform="translate(-63.832 -42.954)" fill="#fcf3e7"/>
<path id="Path_7" data-name="Path 7" d="M78.814,57.25c20.242,4.2,39.725,11.531,58.4,20.286C188.264,101.721,232.449,138.9,268.2,182.36c-8.943-.749-18.095-1.619-26.575-4.725C185.312,147.724,129.112,117.58,72.79,87.691,74.772,77.536,76.9,67.415,78.814,57.25Z" transform="translate(-72.79 -41.699)" fill="#fcf3e7"/>
<path id="Path_8" data-name="Path 8" d="M353.4,98.75c31.542-17.489,65.815-29.152,99.824-40.76q5.551,12.9,11.178,25.782-87.7,46.9-175.529,93.59c-8.59,3.271-17.941,4.1-27.037,4.945A255.536,255.536,0,0,1,353.4,98.75Z" transform="translate(-53.635 -41.624)" fill="#fcf3e7"/>
</g>
<g id="_c68315ff" data-name="#c68315ff" transform="translate(41.606 91.784)">
<path id="Path_9" data-name="Path 9" d="M40.013,85.55q96.905,51.542,193.756,103.216c.022,1.817.033,3.645.044,5.474-7.2-3.414-14.152-7.335-21.2-11.057-47.2-25.242-94.5-50.286-141.707-75.54q-2.874-1.569-5.782-3.073c-5.595-2.919-11.1-6.013-16.751-8.822-.3,5.573-.319,11.156-.231,16.729q.05,115.655.011,231.289c-.132,18.855.275,37.72-.209,56.564q-3.882-2.1-7.83-4.053C39.859,292.7,40.068,189.129,40.013,85.55Z" transform="translate(-39.983 -85.55)" fill="#c68315"/>
</g>
<g id="_e2910dff" data-name="#e2910dff" transform="translate(292.385 91.806)">
<path id="Path_10" data-name="Path 10" d="M296.066,188.786Q393.021,137.31,489.833,85.57c-.088,103.612.176,207.236-.132,310.837-2.059.947-4.108,1.916-6.156,2.852-.3-1.971-.584-3.954-.7-5.936q0-147.093.011-294.218a127.8,127.8,0,0,0-14.394,7.291C411,137.112,353.379,167.53,296,198.389,295.989,195.185,296,191.991,296.066,188.786Z" transform="translate(-264.822 -85.57)" fill="#e2910d"/>
<path id="Path_11" data-name="Path 11" d="M277.58,185.348c.914-.187,2.742-.551,3.667-.738q.017,137,0,274a119.414,119.414,0,0,1-13.557,1.586c2.709-.529,5.385-1.255,8.073-1.916q.2-128.921.055-257.842C276,195.414,274.849,189.907,277.58,185.348Z" transform="translate(-267.69 -75.535)" fill="#e2910d"/>
<path id="Path_12" data-name="Path 12" d="M269.01,451.011c4-.727,8.062-.958,12.1-1.311-.044,7.346.1,14.7-.1,22.06a73.568,73.568,0,0,1-8.965,2.1c1.211-.9,2.4-1.839,3.579-2.775.1-6.729.143-13.458-.077-20.187C273.371,450.922,271.191,450.944,269.01,451.011Z" transform="translate(-267.556 -48.675)" fill="#e2910d"/>
</g>
<g id="_f8a928ff" data-name="#f8a928ff" transform="translate(49.565 101.982)">
<path id="Path_13" data-name="Path 13" d="M47.408,111.539c-.088-5.573-.066-11.156.231-16.729,5.65,2.808,11.156,5.9,16.751,8.822-.43,46.685-.055,93.37-.176,140.055-.033,54.912.055,109.824-.066,164.736-5.716-2.863-11.388-5.859-16.938-9.031.485-18.844.077-37.709.209-56.564Q47.4,227.189,47.408,111.539Z" transform="translate(-47.21 -94.81)" fill="#f8a928"/>
<path id="Path_14" data-name="Path 14" d="M468.456,105.151a127.8,127.8,0,0,1,14.394-7.291q-.05,147.109-.011,294.218c.121,1.982.408,3.965.7,5.936l.055.385q-93.833,49.873-187.577,99.945-.083-150.611-.022-301.2c57.379-30.859,115-61.278,172.456-91.993m-9.141,41.718q-70.242,37.071-140.419,74.3a9.162,9.162,0,0,0-5.253,8.932c-.011,17.7-.088,35.4.033,53.095a8.814,8.814,0,0,0,8.689,8.855c3.568-.121,6.564-2.313,9.659-3.855q67.318-35.65,134.659-71.322a9.319,9.319,0,0,0,5.507-8.756c-.022-18.018.154-36.046-.088-54.064C472.058,147.926,464.58,143.741,459.315,146.869Z" transform="translate(-22.002 -94.501)" fill="#f8a928"/>
<path id="Path_15" data-name="Path 15" d="M68.09,105.61c47.2,25.253,94.5,50.3,141.707,75.54,7.048,3.722,14,7.643,21.2,11.057q.066,152.66,0,305.32-81.625-43.5-163.238-87.06c.231-64.02.022-128.04.1-192.06C68.024,180.808,67.573,143.2,68.09,105.61Z" transform="translate(-45.128 -93.716)" fill="#f8a928"/>
<path id="Path_16" data-name="Path 16" d="M232.045,184.73c2.214.385,4.427.76,6.652,1.079.22,91.134.055,182.269.1,273.4,1.861.132,3.711.253,5.573.374.363-90.98.044-181.971.176-272.963,12.236,1.244,24.5.308,36.652-1.289-2.731,4.559-1.575,10.066-1.762,15.088q-.033,128.921-.055,257.842c-2.687.661-5.363,1.388-8.073,1.916-13.073,1.3-26.278.452-39.251-1.355q-.149-137.049-.011-274.1m23.48,30.54a9.061,9.061,0,0,0-5.9,9.328c.033,54-.066,108,.055,161.994-.242,5.551,5.694,10.088,11,8.469,4.251-1.013,6.938-5.385,6.564-9.637-.033-53.965.077-107.93-.055-161.883.242-5.826-6.245-10.419-11.663-8.271m-.044,189.438a8.733,8.733,0,0,0-5.8,8.2q-.165,13.315.011,26.641c-.209,5.782,6.278,10.308,11.652,8.172a9.075,9.075,0,0,0,5.892-9.35c-.011-8.491.1-16.982-.044-25.463C267.4,407.1,260.889,402.539,255.481,404.708Z" transform="translate(-28.488 -85.699)" fill="#f8a928"/>
<path id="Path_17" data-name="Path 17" d="M232.011,449.63a214.472,214.472,0,0,0,40.749,1.388c2.181-.066,4.361-.088,6.542-.11.22,6.729.176,13.458.077,20.187-1.178.936-2.368,1.872-3.579,2.775-10.242,2.335-20.958,2.126-31.344.936.066-7.775.407-15.573-.363-23.326-1.652-.319-3.293-.65-4.934-.969-.4,6.09-.573,12.2-.374,18.3a12.568,12.568,0,0,0,1.388,5.33c-2.709-.815-5.441-1.553-8.15-2.346Q231.973,460.715,232.011,449.63Z" transform="translate(-28.487 -58.859)" fill="#f8a928"/>
</g>
<g id="_fabf5dff" data-name="#fabf5dff" transform="translate(66.504 110.804)">
<path id="Path_18" data-name="Path 18" d="M62.832,102.82q2.907,1.5,5.782,3.073c-.518,37.588-.066,75.2-.231,112.8-.077,64.02.132,128.04-.1,192.06-1.883-1-3.789-1.993-5.694-2.974v-.165c.121-54.912.033-109.824.066-164.736C62.777,196.19,62.4,149.505,62.832,102.82Z" transform="translate(-62.59 -102.82)" fill="#fabf5d"/>
</g>
<g id="_d9d9d9ff" data-name="#d9d9d9ff" transform="translate(358.794 176.74)">
<path id="Path_19" data-name="Path 19" d="M327.99,228.009q61.669-32.676,123.359-65.319c-.033,11.388.066,22.775-.055,34.163-1.674.881-3.337,1.773-4.978,2.72-.154-9.78.187-19.559-.2-29.328-39.515,20.441-78.557,41.8-118.106,62.181C328,230.95,328,229.485,327.99,228.009Z" transform="translate(-327.99 -162.69)" fill="#d9d9d9"/>
</g>
<g id="_ffffffff" data-name="#ffffffff" transform="translate(358.801 184.295)">
<path id="Path_20" data-name="Path 20" d="M328.011,231.731c39.548-20.385,78.59-41.74,118.106-62.181.385,9.769.044,19.548.2,29.328Q387.241,230.365,328,261.554C328.011,251.621,327.978,241.676,328.011,231.731Z" transform="translate(-327.996 -169.55)" fill="#fff"/>
</g>
<g id="_f8ba55ff" data-name="#f8ba55ff" transform="translate(259.775 202.092)">
<path id="Path_21" data-name="Path 21" d="M238.08,185.71c1.949.165,3.9.33,5.848.485v.33c-.132,90.991.187,181.983-.176,272.963-1.861-.121-3.711-.242-5.573-.374C238.135,367.979,238.3,276.844,238.08,185.71Z" transform="translate(-238.08 -185.71)" fill="#f8ba55"/>
<path id="Path_22" data-name="Path 22" d="M238.168,468.734c-.2-6.1-.022-12.214.374-18.3,1.641.319,3.282.65,4.934.969.771,7.753.43,15.551.363,23.326l-4.284-.661A12.568,12.568,0,0,1,238.168,468.734Z" transform="translate(-238.079 -158.888)" fill="#f8ba55"/>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 12 KiB

+7
View File
@@ -46,6 +46,13 @@
<xs:element minOccurs="0" maxOccurs="1" name="CommunityRating" type="Rating"/>
<xs:element minOccurs="0" maxOccurs="1" default="" name="MainCharacterOrTeam" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" default="" name="Review" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" default="" name="Added" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" default="" name="Released" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" default="" name="FileSize" type="xs:int"/>
<xs:element minOccurs="0" maxOccurs="1" default="" name="FileModifiedTime" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" default="" name="FileCreationTime" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" default="" name="BookPrice" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" default="" name="CustomValuesStore" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="YesNo">
Generated
-298
View File
@@ -1,298 +0,0 @@
# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand.
[[package]]
name = "langcodes"
version = "3.4.0"
description = "Tools for labeling human languages with IETF language tags"
optional = false
python-versions = ">=3.8"
files = [
{file = "langcodes-3.4.0-py3-none-any.whl", hash = "sha256:10a4cc078b8e8937d8485d3352312a0a89a3125190db9f2bb2074250eef654e9"},
{file = "langcodes-3.4.0.tar.gz", hash = "sha256:ae5a77d1a01d0d1e91854a671890892b7ce9abb601ab7327fc5c874f899e1979"},
]
[package.dependencies]
language-data = ">=1.2"
[package.extras]
build = ["build", "twine"]
test = ["pytest", "pytest-cov"]
[package.source]
type = "legacy"
url = "https://pypi.org/simple"
reference = "localpypi"
[[package]]
name = "language-data"
version = "1.2.0"
description = "Supplementary data about languages used by the langcodes module"
optional = false
python-versions = "*"
files = [
{file = "language_data-1.2.0-py3-none-any.whl", hash = "sha256:77d5cab917f91ee0b2f1aa7018443e911cf8985ef734ca2ba3940770f6a3816b"},
{file = "language_data-1.2.0.tar.gz", hash = "sha256:82a86050bbd677bfde87d97885b17566cfe75dad3ac4f5ce44b52c28f752e773"},
]
[package.dependencies]
marisa-trie = ">=0.7.7"
[package.extras]
build = ["build", "twine"]
test = ["pytest", "pytest-cov"]
[package.source]
type = "legacy"
url = "https://pypi.org/simple"
reference = "localpypi"
[[package]]
name = "marisa-trie"
version = "1.2.0"
description = "Static memory-efficient and fast Trie-like structures for Python."
optional = false
python-versions = ">=3.7"
files = [
{file = "marisa_trie-1.2.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:61fab91fef677f0af0e818e61595f2334f7e0b3e122b24ec65889aae69ba468d"},
{file = "marisa_trie-1.2.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:5f5b3080316de735bd2b07265de5eea3ae176fa2fc60f9871aeaa9cdcddfc8f7"},
{file = "marisa_trie-1.2.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:77bfde3287314e91e28d3a882c7b87519ef0ee104c921df72c7819987d5e4863"},
{file = "marisa_trie-1.2.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c4fbb1ec1d9e891060a0aee9f9c243acec63de1e197097a14850ba38ec8a4013"},
{file = "marisa_trie-1.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5e04e9c86fe8908b61c2aebb8444217cacaed15b93d2dccaac3849e36a6dc660"},
{file = "marisa_trie-1.2.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5a7c75a508f44e40f7af8448d466045a97534adcbb026e63989407cefb9ebfa6"},
{file = "marisa_trie-1.2.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:5321211647609869907e81b0230ad2dfdfa7e19fe1ee469b46304a622391e6a1"},
{file = "marisa_trie-1.2.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:88660e6ee0f821872aaf63ba4b9a7513428b9cab20c69cc013c368bd72c3a4fe"},
{file = "marisa_trie-1.2.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:4e4535fc5458de2b59789e574cdd55923d63de5612dc159d33941af79cd62786"},
{file = "marisa_trie-1.2.0-cp310-cp310-win32.whl", hash = "sha256:bdd1d4d430e33abbe558971d1bd57da2d44ca129fa8a86924c51437dba5cb345"},
{file = "marisa_trie-1.2.0-cp310-cp310-win_amd64.whl", hash = "sha256:c729e2b8f9699874b1372b5a01515b340eda1292f5e08a3fe4633b745f80ad7a"},
{file = "marisa_trie-1.2.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:d62985a0e6f2cfeb36cd6afa0460063bbe83ef4bfd9afe189a99103487547210"},
{file = "marisa_trie-1.2.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:1890cc993149db4aa8242973526589e8133c3f92949b0ac74c2c9a6596707ae3"},
{file = "marisa_trie-1.2.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:26177cd0dadb7b44f47c17c40e16ac157c4d22ac7ed83b5a47f44713239e10d1"},
{file = "marisa_trie-1.2.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3425dc81d49a374be49e3a063cb6ccdf57973201b0a30127082acea50562a85e"},
{file = "marisa_trie-1.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:525b8df41a1a7337ed7f982eb63b704d7d75f047e30970fcfbe9cf6fc22c5991"},
{file = "marisa_trie-1.2.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c643c66bbde6a115e4ec8713c087a9fe9cb7b7c684e6af4cf448c120fa427ea4"},
{file = "marisa_trie-1.2.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:5a83fe83e0eab9154a2dc7c556898c86584b7779ddf4214c606fce4ceff07c13"},
{file = "marisa_trie-1.2.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:49701db6bb8f1ec0133abd95f0a4891cfd6f84f3bd019e343037e31a5a5b0210"},
{file = "marisa_trie-1.2.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:a3f0562863deaad58c5dc3a51f706da92582bc9084189148a45f7a12fe261a51"},
{file = "marisa_trie-1.2.0-cp311-cp311-win32.whl", hash = "sha256:b08968ccad00f54f31e38516e4452fae59dd15a3fcee56aea3101ba2304680b3"},
{file = "marisa_trie-1.2.0-cp311-cp311-win_amd64.whl", hash = "sha256:d3ef375491e7dd71a0a7e7bf288c88750942bd1ee0c379dcd6ad43e31af67d00"},
{file = "marisa_trie-1.2.0-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:39b88f126988ea83e8458259297d2b2f9391bfba8f4dc5d7a246813aae1c1def"},
{file = "marisa_trie-1.2.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:ec167b006884a90d130ee30518a9aa44cb40211f702bf07031b2d7d4d1db569b"},
{file = "marisa_trie-1.2.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:1b855e6286faef5411386bf9d676dfb545c09f7d109f197f347c9366aeb12f07"},
{file = "marisa_trie-1.2.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8cd287ff323224d87c2b739cba39614aac3737c95a254e0ff70e77d9b8df226d"},
{file = "marisa_trie-1.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5d8a1c0361165231f4fb915237470afc8cc4803c535f535f4fc42ca72855b124"},
{file = "marisa_trie-1.2.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3267f438d258d7d85ee3dde363c4f96c3196ca9cd9e63fe429a59543cc544b15"},
{file = "marisa_trie-1.2.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:7c87a0c2cccce12b07bfcb70708637c0816970282d966a1531ecda1a24bd1cc8"},
{file = "marisa_trie-1.2.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:d3c0e38f0501951e2322f7274a39b8e2344bbd91ceaa9da439f46022570ddc9d"},
{file = "marisa_trie-1.2.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:cd88a338c87e6dc130b6cea7b697580c21f0c83a8a8b46671cfecbb713d3fe24"},
{file = "marisa_trie-1.2.0-cp312-cp312-win32.whl", hash = "sha256:5cea60975184f03fbcff51339df0eb44d2abe106a1693983cc64415eb87b897b"},
{file = "marisa_trie-1.2.0-cp312-cp312-win_amd64.whl", hash = "sha256:b04a07b99b62b9bdf3eaf1d44571a3293ce249ce8971944e780c9c709593462f"},
{file = "marisa_trie-1.2.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:c11af35d9304de420b359741e12b885d04f11403697efcbbe8cb50f834261ebc"},
{file = "marisa_trie-1.2.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2db8e74493c3bffb480c54afaa88890a39bf90063ff5b322acf64bf076e4b36e"},
{file = "marisa_trie-1.2.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9bcc6613bc873136dc62609b66aaa27363e2bd46c03fdab62d638f7cf69d5f82"},
{file = "marisa_trie-1.2.0-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f5cb731581effb3e05258f3ddc2a155475de74bb00f61eb280f991e13b48f783"},
{file = "marisa_trie-1.2.0-cp37-cp37m-musllinux_1_2_aarch64.whl", hash = "sha256:eba1061bbeaeec4149282beab2ae163631606f119f549a10246b014e13f9047b"},
{file = "marisa_trie-1.2.0-cp37-cp37m-musllinux_1_2_i686.whl", hash = "sha256:015594427360c6ad0fa94d51ee3d50fb83b0f7278996497fd2d69f877c3de9bd"},
{file = "marisa_trie-1.2.0-cp37-cp37m-musllinux_1_2_x86_64.whl", hash = "sha256:36d65bcbf22a70cdd0202bd8608c2feecc58bdb9e5dd9a2f5a723b651fcab287"},
{file = "marisa_trie-1.2.0-cp37-cp37m-win32.whl", hash = "sha256:bc138625b383998f5cd0cbf6cd38d66d414f3786ae6d7b4e4a6fc970140ef4e9"},
{file = "marisa_trie-1.2.0-cp37-cp37m-win_amd64.whl", hash = "sha256:27d270a64eb655754dfb4e352c60a084b16ab999b3a97a0cdc7dbecbca3c0e35"},
{file = "marisa_trie-1.2.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:fa1fa7f67d317a921315a65e266b9e156ce5a956076ec2b6dbf72d67c7df8216"},
{file = "marisa_trie-1.2.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:9dccef41d4af11a03558c1d101de58bd723b3039a5bc4e064250008c118037ec"},
{file = "marisa_trie-1.2.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:873efd212dfef2b736ff2ff43e10b348c428d5dbac7b8cb8aa777004bc8c7b0e"},
{file = "marisa_trie-1.2.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8af7a21ac2ba6dc23e4257fc3a40b3070e776275d3d0b5b2ef44473ad92caf3a"},
{file = "marisa_trie-1.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e7202ba0ca1db5245feaebbeb3d0c776b2da1fffb0abc3500dd505f679686aa1"},
{file = "marisa_trie-1.2.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:83d90be28c083323909d23ff8e9b4a2764b9e75520d1bae1a277e9fa7ca20d15"},
{file = "marisa_trie-1.2.0-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:40e2a374026492ac84232897f1f1d8f92a4a1f8bcf3f0ded1f2b8b708d1acfff"},
{file = "marisa_trie-1.2.0-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:7c6e6506bd24a5799b9b4b9cf1e8d6fa281f136396ba018a95d95d4d74715227"},
{file = "marisa_trie-1.2.0-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:437bf6c0d7ba4cf17656a0e3bdd0b3c2c92c01fedfa670904177eef3116a4f45"},
{file = "marisa_trie-1.2.0-cp38-cp38-win32.whl", hash = "sha256:6aeef7b364fb3b34dbba1cc57b79f1668fad0c3f039738d65a5b0d5ddce15f47"},
{file = "marisa_trie-1.2.0-cp38-cp38-win_amd64.whl", hash = "sha256:02f773e85cc566a24c0e0e28c744052db7691c4f13d02e4257bc657a49b9ab14"},
{file = "marisa_trie-1.2.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:6ff705cb3b907bdeacb8c4b3bf0541691f52b101014d189a707ca41ebfacad59"},
{file = "marisa_trie-1.2.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:006419c59866979188906babc42ae0918081c18cabc2bdabca027f68c081c127"},
{file = "marisa_trie-1.2.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a7196691681ecb8a12629fb6277c33bafdb27cf2b6c18c28bc48fa42a15eab8f"},
{file = "marisa_trie-1.2.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:eaf052c0a1f4531ee12fd4c637212e77ad2af8c3b38a0d3096622abd01a22212"},
{file = "marisa_trie-1.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9fb95f3ab95ba933f6a2fa2629185e9deb9da45ff2aa4ba8cc8f722528c038ef"},
{file = "marisa_trie-1.2.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7459b1e1937e33daed65a6d55f8b95f9a8601f4f8749d01641cf548ecac03840"},
{file = "marisa_trie-1.2.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:902ea948677421093651ca98df62d255383f865f7c353f956ef666e92500e79f"},
{file = "marisa_trie-1.2.0-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:fdf7a2d066907816726f3bf241b8cb05b698d6ffaa3c5ea2658d4ba69e87ec57"},
{file = "marisa_trie-1.2.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:3540bb85b38dfc17060263e061c95a0a435681b04543d1ae7e8d7441a9790593"},
{file = "marisa_trie-1.2.0-cp39-cp39-win32.whl", hash = "sha256:fe1394e1f262e5b45d22d30bd1ef75174d1f2772e86716b5f93f9c29dfc1a779"},
{file = "marisa_trie-1.2.0-cp39-cp39-win_amd64.whl", hash = "sha256:84c44cb13803723f0f76aa2ba1a657f762a0bb9d8a9b80dfff249bb1c3218dd6"},
{file = "marisa_trie-1.2.0-pp310-pypy310_pp73-macosx_10_9_x86_64.whl", hash = "sha256:035c4c8f3b313b4d7b7451ddd539da811a11077a9e359c6a0345f816b1bdccb3"},
{file = "marisa_trie-1.2.0-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:d4f05c2ee218a5ab09d269b640d06f9708b0cf37c842344cbdffb0661c74c472"},
{file = "marisa_trie-1.2.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:92ac63e1519598de946c7d9346df3bb52ed96968eb3021b4e89b51d79bc72a86"},
{file = "marisa_trie-1.2.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:045f32eaeb5dcdb5beadb571ba616d7a34141764b616eebb4decce71b366f5fa"},
{file = "marisa_trie-1.2.0-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:cb60c2f9897ce2bfc31a69ac25a040de4f8643ab2a339bb0ff1185e1a9dedaf8"},
{file = "marisa_trie-1.2.0-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:f19c5fcf23c02f1303deb69c67603ee37ed8f01de2d8b19f1716a6cf5afd5455"},
{file = "marisa_trie-1.2.0-pp37-pypy37_pp73-macosx_10_9_x86_64.whl", hash = "sha256:a06a77075240eb83a47b780902322e66c968a06a2b6318cab06757c65ea64190"},
{file = "marisa_trie-1.2.0-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:125016400449e46ec0e5fabd14c8314959c4dfa02ffc2861195c99efa2b5b011"},
{file = "marisa_trie-1.2.0-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c57647dd9f9ba16fc5bb4679c915d7d48d5c0b25134fb10f095ccd839686a027"},
{file = "marisa_trie-1.2.0-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6601e74338fb31e1b20674257706150113463182a01d3a1310df6b8840720b17"},
{file = "marisa_trie-1.2.0-pp37-pypy37_pp73-win_amd64.whl", hash = "sha256:ce2f68e1000c4c72820c5b2c9d037f326fcf75f036453a5e629f225f99b92cfc"},
{file = "marisa_trie-1.2.0-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:069ac10a133d96b3f3ed1cc071b973a3f28490345e7941c778a1d81cf176f04a"},
{file = "marisa_trie-1.2.0-pp38-pypy38_pp73-macosx_11_0_arm64.whl", hash = "sha256:de9911480ce2a0513582cb84ee4484e5ee8791e692276c7f5cd7378e114d1988"},
{file = "marisa_trie-1.2.0-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4cfec001cf233e8853a29e1c2bb74031c217aa61e7bd19389007e04861855731"},
{file = "marisa_trie-1.2.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bd1f3ef8de89684fbdd6aaead09d53b82e718bad4375d2beb938cbd24b48c51a"},
{file = "marisa_trie-1.2.0-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:65f5d8c1ecc85283b5b03a1475a5da723b94b3beda752c895b2f748477d8f1b1"},
{file = "marisa_trie-1.2.0-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:2e7540f844c1de493a90ad7d0f5bffc6a2cba19fe312d6db7b97aceff11d97f8"},
{file = "marisa_trie-1.2.0-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:2fb9243f66563285677079c9dccc697d35985287bacb36c8e685305687b0e025"},
{file = "marisa_trie-1.2.0-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:58e2b84cbb6394f9c567f1f4351fc2995a094e1b684da9b577d4139b145401d6"},
{file = "marisa_trie-1.2.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5b4a8d3ed1f1b8f551b52e11a1265eaf0718f06bb206654b2c529cecda0913dd"},
{file = "marisa_trie-1.2.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a97652c5fbc92f52100afe1c4583625015611000fa81606ad17f1b3bbb9f3bfa"},
{file = "marisa_trie-1.2.0-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a7183d84da20c89b2a366bf581f0d79d1e248909678f164e8536f291120432e8"},
{file = "marisa_trie-1.2.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:c7f4df4163202b0aa5dad3eeddf088ecb61e9101986c8b31f1e052ebd6df9292"},
{file = "marisa_trie-1.2.0.tar.gz", hash = "sha256:fedfc67497f8aa2757756b5cf493759f245d321fb78914ce125b6d75daa89b5f"},
]
[package.dependencies]
setuptools = "*"
[package.extras]
test = ["hypothesis", "pytest", "readme-renderer"]
[package.source]
type = "legacy"
url = "https://pypi.org/simple"
reference = "localpypi"
[[package]]
name = "pillow"
version = "10.4.0"
description = "Python Imaging Library (Fork)"
optional = false
python-versions = ">=3.8"
files = [
{file = "pillow-10.4.0-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:4d9667937cfa347525b319ae34375c37b9ee6b525440f3ef48542fcf66f2731e"},
{file = "pillow-10.4.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:543f3dc61c18dafb755773efc89aae60d06b6596a63914107f75459cf984164d"},
{file = "pillow-10.4.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7928ecbf1ece13956b95d9cbcfc77137652b02763ba384d9ab508099a2eca856"},
{file = "pillow-10.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e4d49b85c4348ea0b31ea63bc75a9f3857869174e2bf17e7aba02945cd218e6f"},
{file = "pillow-10.4.0-cp310-cp310-manylinux_2_28_aarch64.whl", hash = "sha256:6c762a5b0997f5659a5ef2266abc1d8851ad7749ad9a6a5506eb23d314e4f46b"},
{file = "pillow-10.4.0-cp310-cp310-manylinux_2_28_x86_64.whl", hash = "sha256:a985e028fc183bf12a77a8bbf36318db4238a3ded7fa9df1b9a133f1cb79f8fc"},
{file = "pillow-10.4.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:812f7342b0eee081eaec84d91423d1b4650bb9828eb53d8511bcef8ce5aecf1e"},
{file = "pillow-10.4.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:ac1452d2fbe4978c2eec89fb5a23b8387aba707ac72810d9490118817d9c0b46"},
{file = "pillow-10.4.0-cp310-cp310-win32.whl", hash = "sha256:bcd5e41a859bf2e84fdc42f4edb7d9aba0a13d29a2abadccafad99de3feff984"},
{file = "pillow-10.4.0-cp310-cp310-win_amd64.whl", hash = "sha256:ecd85a8d3e79cd7158dec1c9e5808e821feea088e2f69a974db5edf84dc53141"},
{file = "pillow-10.4.0-cp310-cp310-win_arm64.whl", hash = "sha256:ff337c552345e95702c5fde3158acb0625111017d0e5f24bf3acdb9cc16b90d1"},
{file = "pillow-10.4.0-cp311-cp311-macosx_10_10_x86_64.whl", hash = "sha256:0a9ec697746f268507404647e531e92889890a087e03681a3606d9b920fbee3c"},
{file = "pillow-10.4.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:dfe91cb65544a1321e631e696759491ae04a2ea11d36715eca01ce07284738be"},
{file = "pillow-10.4.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5dc6761a6efc781e6a1544206f22c80c3af4c8cf461206d46a1e6006e4429ff3"},
{file = "pillow-10.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5e84b6cc6a4a3d76c153a6b19270b3526a5a8ed6b09501d3af891daa2a9de7d6"},
{file = "pillow-10.4.0-cp311-cp311-manylinux_2_28_aarch64.whl", hash = "sha256:bbc527b519bd3aa9d7f429d152fea69f9ad37c95f0b02aebddff592688998abe"},
{file = "pillow-10.4.0-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:76a911dfe51a36041f2e756b00f96ed84677cdeb75d25c767f296c1c1eda1319"},
{file = "pillow-10.4.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:59291fb29317122398786c2d44427bbd1a6d7ff54017075b22be9d21aa59bd8d"},
{file = "pillow-10.4.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:416d3a5d0e8cfe4f27f574362435bc9bae57f679a7158e0096ad2beb427b8696"},
{file = "pillow-10.4.0-cp311-cp311-win32.whl", hash = "sha256:7086cc1d5eebb91ad24ded9f58bec6c688e9f0ed7eb3dbbf1e4800280a896496"},
{file = "pillow-10.4.0-cp311-cp311-win_amd64.whl", hash = "sha256:cbed61494057c0f83b83eb3a310f0bf774b09513307c434d4366ed64f4128a91"},
{file = "pillow-10.4.0-cp311-cp311-win_arm64.whl", hash = "sha256:f5f0c3e969c8f12dd2bb7e0b15d5c468b51e5017e01e2e867335c81903046a22"},
{file = "pillow-10.4.0-cp312-cp312-macosx_10_10_x86_64.whl", hash = "sha256:673655af3eadf4df6b5457033f086e90299fdd7a47983a13827acf7459c15d94"},
{file = "pillow-10.4.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:866b6942a92f56300012f5fbac71f2d610312ee65e22f1aa2609e491284e5597"},
{file = "pillow-10.4.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:29dbdc4207642ea6aad70fbde1a9338753d33fb23ed6956e706936706f52dd80"},
{file = "pillow-10.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bf2342ac639c4cf38799a44950bbc2dfcb685f052b9e262f446482afaf4bffca"},
{file = "pillow-10.4.0-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:f5b92f4d70791b4a67157321c4e8225d60b119c5cc9aee8ecf153aace4aad4ef"},
{file = "pillow-10.4.0-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:86dcb5a1eb778d8b25659d5e4341269e8590ad6b4e8b44d9f4b07f8d136c414a"},
{file = "pillow-10.4.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:780c072c2e11c9b2c7ca37f9a2ee8ba66f44367ac3e5c7832afcfe5104fd6d1b"},
{file = "pillow-10.4.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:37fb69d905be665f68f28a8bba3c6d3223c8efe1edf14cc4cfa06c241f8c81d9"},
{file = "pillow-10.4.0-cp312-cp312-win32.whl", hash = "sha256:7dfecdbad5c301d7b5bde160150b4db4c659cee2b69589705b6f8a0c509d9f42"},
{file = "pillow-10.4.0-cp312-cp312-win_amd64.whl", hash = "sha256:1d846aea995ad352d4bdcc847535bd56e0fd88d36829d2c90be880ef1ee4668a"},
{file = "pillow-10.4.0-cp312-cp312-win_arm64.whl", hash = "sha256:e553cad5179a66ba15bb18b353a19020e73a7921296a7979c4a2b7f6a5cd57f9"},
{file = "pillow-10.4.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:8bc1a764ed8c957a2e9cacf97c8b2b053b70307cf2996aafd70e91a082e70df3"},
{file = "pillow-10.4.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:6209bb41dc692ddfee4942517c19ee81b86c864b626dbfca272ec0f7cff5d9fb"},
{file = "pillow-10.4.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bee197b30783295d2eb680b311af15a20a8b24024a19c3a26431ff83eb8d1f70"},
{file = "pillow-10.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1ef61f5dd14c300786318482456481463b9d6b91ebe5ef12f405afbba77ed0be"},
{file = "pillow-10.4.0-cp313-cp313-manylinux_2_28_aarch64.whl", hash = "sha256:297e388da6e248c98bc4a02e018966af0c5f92dfacf5a5ca22fa01cb3179bca0"},
{file = "pillow-10.4.0-cp313-cp313-manylinux_2_28_x86_64.whl", hash = "sha256:e4db64794ccdf6cb83a59d73405f63adbe2a1887012e308828596100a0b2f6cc"},
{file = "pillow-10.4.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:bd2880a07482090a3bcb01f4265f1936a903d70bc740bfcb1fd4e8a2ffe5cf5a"},
{file = "pillow-10.4.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:4b35b21b819ac1dbd1233317adeecd63495f6babf21b7b2512d244ff6c6ce309"},
{file = "pillow-10.4.0-cp313-cp313-win32.whl", hash = "sha256:551d3fd6e9dc15e4c1eb6fc4ba2b39c0c7933fa113b220057a34f4bb3268a060"},
{file = "pillow-10.4.0-cp313-cp313-win_amd64.whl", hash = "sha256:030abdbe43ee02e0de642aee345efa443740aa4d828bfe8e2eb11922ea6a21ea"},
{file = "pillow-10.4.0-cp313-cp313-win_arm64.whl", hash = "sha256:5b001114dd152cfd6b23befeb28d7aee43553e2402c9f159807bf55f33af8a8d"},
{file = "pillow-10.4.0-cp38-cp38-macosx_10_10_x86_64.whl", hash = "sha256:8d4d5063501b6dd4024b8ac2f04962d661222d120381272deea52e3fc52d3736"},
{file = "pillow-10.4.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7c1ee6f42250df403c5f103cbd2768a28fe1a0ea1f0f03fe151c8741e1469c8b"},
{file = "pillow-10.4.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b15e02e9bb4c21e39876698abf233c8c579127986f8207200bc8a8f6bb27acf2"},
{file = "pillow-10.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7a8d4bade9952ea9a77d0c3e49cbd8b2890a399422258a77f357b9cc9be8d680"},
{file = "pillow-10.4.0-cp38-cp38-manylinux_2_28_aarch64.whl", hash = "sha256:43efea75eb06b95d1631cb784aa40156177bf9dd5b4b03ff38979e048258bc6b"},
{file = "pillow-10.4.0-cp38-cp38-manylinux_2_28_x86_64.whl", hash = "sha256:950be4d8ba92aca4b2bb0741285a46bfae3ca699ef913ec8416c1b78eadd64cd"},
{file = "pillow-10.4.0-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:d7480af14364494365e89d6fddc510a13e5a2c3584cb19ef65415ca57252fb84"},
{file = "pillow-10.4.0-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:73664fe514b34c8f02452ffb73b7a92c6774e39a647087f83d67f010eb9a0cf0"},
{file = "pillow-10.4.0-cp38-cp38-win32.whl", hash = "sha256:e88d5e6ad0d026fba7bdab8c3f225a69f063f116462c49892b0149e21b6c0a0e"},
{file = "pillow-10.4.0-cp38-cp38-win_amd64.whl", hash = "sha256:5161eef006d335e46895297f642341111945e2c1c899eb406882a6c61a4357ab"},
{file = "pillow-10.4.0-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:0ae24a547e8b711ccaaf99c9ae3cd975470e1a30caa80a6aaee9a2f19c05701d"},
{file = "pillow-10.4.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:298478fe4f77a4408895605f3482b6cc6222c018b2ce565c2b6b9c354ac3229b"},
{file = "pillow-10.4.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:134ace6dc392116566980ee7436477d844520a26a4b1bd4053f6f47d096997fd"},
{file = "pillow-10.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:930044bb7679ab003b14023138b50181899da3f25de50e9dbee23b61b4de2126"},
{file = "pillow-10.4.0-cp39-cp39-manylinux_2_28_aarch64.whl", hash = "sha256:c76e5786951e72ed3686e122d14c5d7012f16c8303a674d18cdcd6d89557fc5b"},
{file = "pillow-10.4.0-cp39-cp39-manylinux_2_28_x86_64.whl", hash = "sha256:b2724fdb354a868ddf9a880cb84d102da914e99119211ef7ecbdc613b8c96b3c"},
{file = "pillow-10.4.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:dbc6ae66518ab3c5847659e9988c3b60dc94ffb48ef9168656e0019a93dbf8a1"},
{file = "pillow-10.4.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:06b2f7898047ae93fad74467ec3d28fe84f7831370e3c258afa533f81ef7f3df"},
{file = "pillow-10.4.0-cp39-cp39-win32.whl", hash = "sha256:7970285ab628a3779aecc35823296a7869f889b8329c16ad5a71e4901a3dc4ef"},
{file = "pillow-10.4.0-cp39-cp39-win_amd64.whl", hash = "sha256:961a7293b2457b405967af9c77dcaa43cc1a8cd50d23c532e62d48ab6cdd56f5"},
{file = "pillow-10.4.0-cp39-cp39-win_arm64.whl", hash = "sha256:32cda9e3d601a52baccb2856b8ea1fc213c90b340c542dcef77140dfa3278a9e"},
{file = "pillow-10.4.0-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:5b4815f2e65b30f5fbae9dfffa8636d992d49705723fe86a3661806e069352d4"},
{file = "pillow-10.4.0-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:8f0aef4ef59694b12cadee839e2ba6afeab89c0f39a3adc02ed51d109117b8da"},
{file = "pillow-10.4.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9f4727572e2918acaa9077c919cbbeb73bd2b3ebcfe033b72f858fc9fbef0026"},
{file = "pillow-10.4.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ff25afb18123cea58a591ea0244b92eb1e61a1fd497bf6d6384f09bc3262ec3e"},
{file = "pillow-10.4.0-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:dc3e2db6ba09ffd7d02ae9141cfa0ae23393ee7687248d46a7507b75d610f4f5"},
{file = "pillow-10.4.0-pp310-pypy310_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:02a2be69f9c9b8c1e97cf2713e789d4e398c751ecfd9967c18d0ce304efbf885"},
{file = "pillow-10.4.0-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:0755ffd4a0c6f267cccbae2e9903d95477ca2f77c4fcf3a3a09570001856c8a5"},
{file = "pillow-10.4.0-pp39-pypy39_pp73-macosx_10_15_x86_64.whl", hash = "sha256:a02364621fe369e06200d4a16558e056fe2805d3468350df3aef21e00d26214b"},
{file = "pillow-10.4.0-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:1b5dea9831a90e9d0721ec417a80d4cbd7022093ac38a568db2dd78363b00908"},
{file = "pillow-10.4.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9b885f89040bb8c4a1573566bbb2f44f5c505ef6e74cec7ab9068c900047f04b"},
{file = "pillow-10.4.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:87dd88ded2e6d74d31e1e0a99a726a6765cda32d00ba72dc37f0651f306daaa8"},
{file = "pillow-10.4.0-pp39-pypy39_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:2db98790afc70118bd0255c2eeb465e9767ecf1f3c25f9a1abb8ffc8cfd1fe0a"},
{file = "pillow-10.4.0-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:f7baece4ce06bade126fb84b8af1c33439a76d8a6fd818970215e0560ca28c27"},
{file = "pillow-10.4.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:cfdd747216947628af7b259d274771d84db2268ca062dd5faf373639d00113a3"},
{file = "pillow-10.4.0.tar.gz", hash = "sha256:166c1cd4d24309b30d61f79f4a9114b7b2313d7450912277855ff5dfd7cd4a06"},
]
[package.extras]
docs = ["furo", "olefile", "sphinx (>=7.3)", "sphinx-copybutton", "sphinx-inline-tabs", "sphinxext-opengraph"]
fpx = ["olefile"]
mic = ["olefile"]
tests = ["check-manifest", "coverage", "defusedxml", "markdown2", "olefile", "packaging", "pyroma", "pytest", "pytest-cov", "pytest-timeout"]
typing = ["typing-extensions"]
xmp = ["defusedxml"]
[package.source]
type = "legacy"
url = "https://pypi.org/simple"
reference = "localpypi"
[[package]]
name = "setuptools"
version = "70.3.0"
description = "Easily download, build, install, upgrade, and uninstall Python packages"
optional = false
python-versions = ">=3.8"
files = [
{file = "setuptools-70.3.0-py3-none-any.whl", hash = "sha256:fe384da74336c398e0d956d1cae0669bc02eed936cdb1d49b57de1990dc11ffc"},
{file = "setuptools-70.3.0.tar.gz", hash = "sha256:f171bab1dfbc86b132997f26a119f6056a57950d058587841a0082e8830f9dc5"},
]
[package.extras]
doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "pyproject-hooks (!=1.1)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier"]
test = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "importlib-metadata", "ini2toml[lite] (>=0.14)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "jaraco.test", "mypy (==1.10.0)", "packaging (>=23.2)", "pip (>=19.1)", "pyproject-hooks (!=1.1)", "pytest (>=6,!=8.1.*)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-home (>=0.5)", "pytest-mypy", "pytest-perf", "pytest-ruff (>=0.3.2)", "pytest-subprocess", "pytest-timeout", "pytest-xdist (>=3)", "tomli", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"]
[package.source]
type = "legacy"
url = "https://pypi.org/simple"
reference = "localpypi"
[[package]]
name = "xmltodict"
version = "0.13.0"
description = "Makes working with XML feel like you are working with JSON"
optional = false
python-versions = ">=3.4"
files = [
{file = "xmltodict-0.13.0-py2.py3-none-any.whl", hash = "sha256:aa89e8fd76320154a40d19a0df04a4695fb9dc5ba977cbb68ab3e4eb225e7852"},
{file = "xmltodict-0.13.0.tar.gz", hash = "sha256:341595a488e3e01a85a9d8911d8912fd922ede5fecc4dce437eb4b6c8d037e56"},
]
[package.source]
type = "legacy"
url = "https://pypi.org/simple"
reference = "localpypi"
[metadata]
lock-version = "2.0"
python-versions = "^3.8"
content-hash = "dfb034cdc323648effbcfff969cae65cbca1b04130c64d68c8c8968f0d692e71"
+31 -9
View File
@@ -4,12 +4,22 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "cbz"
version = "3.3.0"
description = "CBZ simplifies creating, managing, and viewing comic book files in CBZ format, offering seamless packaging, metadata handling, and built-in viewing capabilities"
version = "3.4.3"
description = "CBZ simplifies creating, managing, and viewing comic book files in CBZ, CBR, and PDF formats, offering seamless packaging, metadata handling and built-in viewing capabilities."
license = "MIT"
authors = ["hyugogirubato <65763543+hyugogirubato@users.noreply.github.com>"]
readme = "README.md"
keywords = ["python", "cbz", "ebooks", "manga", "comics", "webtoons"]
repository = "https://github.com/hyugogirubato/cbz"
keywords = [
"python",
"cbz",
"cbr",
"pdf",
"ebooks",
"manga",
"comics",
"webtoons",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
@@ -17,12 +27,12 @@ classifiers = [
"Natural Language :: English",
"Operating System :: OS Independent",
"Topic :: Utilities",
"Topic :: Software Development :: Libraries :: Python Modules"
"Topic :: Software Development :: Libraries :: Python Modules",
]
include = [
{ path = "CHANGELOG.md", format = "sdist" },
{ path = "README.md", format = "sdist" },
{ path = "LICENSE", format = "sdist" }
{ path = "LICENSE", format = "sdist" },
]
[tool.poetry.urls]
@@ -30,10 +40,12 @@ include = [
"Changelog" = "https://github.com/hyugogirubato/cbz/blob/main/CHANGELOG.md"
[tool.poetry.dependencies]
python = "^3.8"
xmltodict = "^0.13.0"
langcodes = "^3.4.0"
Pillow = "^10.4.0"
python = ">=3.8,<4.0"
langcodes = ">=3.4.0"
Pillow = ">=10.4.0"
pypdf = ">=5.7.0"
rarfile = ">=4.2"
xmltodict = ">=0.14.2"
[tool.poetry.scripts]
cbzplayer = "cbz.__main__:main"
@@ -43,5 +55,15 @@ name = "localpypi"
url = "https://pypi.org/simple/"
priority = "primary"
[tool.poetry.group.dev.dependencies]
pytest = ">=7.4.0,<9.0.0"
pytest-cov = ">=5.0.0"
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = [
"--cov=cbz",
]
[certificates]
localpypi = { cert = false }
View File
+55
View File
@@ -0,0 +1,55 @@
from pathlib import Path
import pytest
from cbz.comic import ComicInfo
from cbz.page import PageInfo
from cbz.constants import PageType
@pytest.fixture
def fixtures_dir() -> Path:
"""Fixture that provides the path to the test fixtures directory."""
return Path(__file__).parent / 'fixtures'
@pytest.fixture
def images_dir(fixtures_dir: Path) -> Path:
"""Fixture that provides the path to the test images directory."""
return fixtures_dir / 'images'
@pytest.fixture
def sample_image_path(images_dir: Path) -> Path:
"""Fixture that provides a sample image path."""
return images_dir / 'page-000.jpg'
@pytest.fixture
def sample_cbz_file(tmp_path: Path, images_dir: Path) -> Path:
"""Fixture that creates a sample CBZ file for testing."""
# Load sample pages
image_paths = sorted(list(images_dir.iterdir()))[:3] # Use first 3 images
pages = []
for i, path in enumerate(image_paths):
page_type = PageType.FRONT_COVER if i == 0 else PageType.STORY
page = PageInfo.load(path=path, type=page_type)
pages.append(page)
# Create comic from pages
comic = ComicInfo.from_pages(
pages=pages,
title='Test Comic',
series='Test Series',
number=1,
volume=1,
year=2024
)
# Save to temporary file
cbz_path = tmp_path / 'test_comic.cbz'
cbz_content = comic.pack()
cbz_path.write_bytes(cbz_content)
return cbz_path
+2 -2
View File
@@ -7,7 +7,7 @@ from cbz.page import PageInfo
PARENT = Path(__file__).parent
if __name__ == '__main__':
paths = list((PARENT / 'images').iterdir())
paths = list((PARENT / 'fixtures' / 'images').iterdir())
# Load each page from the 'images' folder into a list of PageInfo objects
pages = [
@@ -50,7 +50,7 @@ if __name__ == '__main__':
comic.show()
# Pack the comic book content into a CBZ file format
cbz_content = comic.pack()
cbz_content = comic.pack(rename=True)
# Define the path where the CBZ file will be saved
cbz_path = PARENT / f'{comic.title}.cbz'

Before

Width:  |  Height:  |  Size: 247 KiB

After

Width:  |  Height:  |  Size: 247 KiB

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 143 KiB

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 120 KiB

Before

Width:  |  Height:  |  Size: 619 KiB

After

Width:  |  Height:  |  Size: 619 KiB

Before

Width:  |  Height:  |  Size: 592 KiB

After

Width:  |  Height:  |  Size: 592 KiB

Before

Width:  |  Height:  |  Size: 680 KiB

After

Width:  |  Height:  |  Size: 680 KiB

Before

Width:  |  Height:  |  Size: 590 KiB

After

Width:  |  Height:  |  Size: 590 KiB

Before

Width:  |  Height:  |  Size: 492 KiB

After

Width:  |  Height:  |  Size: 492 KiB

Before

Width:  |  Height:  |  Size: 479 KiB

After

Width:  |  Height:  |  Size: 479 KiB

Before

Width:  |  Height:  |  Size: 549 KiB

After

Width:  |  Height:  |  Size: 549 KiB

+179
View File
@@ -0,0 +1,179 @@
import tempfile
from pathlib import Path
from typing import List
from cbz.comic import ComicInfo
from cbz.page import PageInfo
from cbz.constants import PageType, YesNo, Manga, AgeRating, Format
class TestComicInfo:
"""Test cases for ComicInfo class."""
def test_from_pages_creation(self, images_dir: Path) -> None:
"""Test creating ComicInfo from pages."""
# Load sample pages
image_paths = sorted(list(images_dir.iterdir()))[:3] # Use first 3 images
pages: List[PageInfo] = []
for i, path in enumerate(image_paths):
page_type = PageType.FRONT_COVER if i == 0 else PageType.STORY
page = PageInfo.load(path=path, type=page_type)
pages.append(page)
# Create comic from pages
comic = ComicInfo.from_pages(
pages=pages,
title='Test Comic',
series='Test Series',
number=1,
volume=1,
year=2024
)
assert comic.title == 'Test Comic'
assert comic.series == 'Test Series'
assert comic.number == 1
assert comic.volume == 1
assert comic.year == 2024
assert len(comic.pages) == 3
assert comic.pages[0].type == PageType.FRONT_COVER
assert comic.pages[1].type == PageType.STORY
def test_from_cbz_file(self, sample_cbz_file: Path) -> None:
"""Test loading ComicInfo from CBZ file."""
comic = ComicInfo.from_cbz(sample_cbz_file)
assert comic is not None
assert hasattr(comic, 'pages')
assert len(comic.pages) > 0
assert all(isinstance(page, PageInfo) for page in comic.pages)
def test_pack_cbz(self, images_dir: Path) -> None:
"""Test packing comic into CBZ format."""
# Create a simple comic
image_paths = sorted(list(images_dir.iterdir()))[:2]
pages = [PageInfo.load(path=path) for path in image_paths]
comic = ComicInfo.from_pages(
pages=pages,
title='Pack Test',
series='Test Series'
)
# Pack to CBZ
cbz_content = comic.pack()
assert isinstance(cbz_content, bytes)
assert len(cbz_content) > 0
def test_pack_with_rename(self, images_dir: Path) -> None:
"""Test packing comic with page renaming."""
image_paths = sorted(list(images_dir.iterdir()))[:2]
pages = [PageInfo.load(path=path) for path in image_paths]
comic = ComicInfo.from_pages(
pages=pages,
title='Rename Test'
)
# Pack with rename option
cbz_content = comic.pack(rename=True)
assert isinstance(cbz_content, bytes)
assert len(cbz_content) > 0
def test_comic_metadata_properties(self, images_dir: Path) -> None:
"""Test comic metadata properties."""
image_paths = sorted(list(images_dir.iterdir()))[:1]
pages = [PageInfo.load(path=path) for path in image_paths]
comic = ComicInfo.from_pages(
pages=pages,
title='Metadata Test',
series='Test Series',
number=5,
count=10,
volume=2,
summary='Test summary',
year=2023,
month=6,
day=15,
writer='Test Writer',
penciller='Test Penciller',
inker='Test Inker',
colorist='Test Colorist',
letterer='Test Letterer',
cover_artist='Test Cover Artist',
editor='Test Editor',
publisher='Test Publisher',
imprint='Test Imprint',
genre='Test Genre',
language_iso='en',
format=Format.SERIES,
black_white=YesNo.NO,
manga=Manga.RIGHT_LEFT,
age_rating=AgeRating.TEEN,
community_rating=4
)
assert comic.title == 'Metadata Test'
assert comic.series == 'Test Series'
assert comic.number == 5
assert comic.count == 10
assert comic.volume == 2
assert comic.summary == 'Test summary'
assert comic.year == 2023
assert comic.month == 6
assert comic.day == 15
assert comic.writer == 'Test Writer'
assert comic.penciller == 'Test Penciller'
assert comic.inker == 'Test Inker'
assert comic.colorist == 'Test Colorist'
assert comic.letterer == 'Test Letterer'
assert comic.cover_artist == 'Test Cover Artist'
assert comic.editor == 'Test Editor'
assert comic.publisher == 'Test Publisher'
assert comic.imprint == 'Test Imprint'
assert comic.genre == 'Test Genre'
assert comic.language_iso == 'en'
assert comic.format == Format.SERIES
assert comic.black_white == YesNo.NO
assert comic.manga == Manga.RIGHT_LEFT
assert comic.age_rating == AgeRating.TEEN
assert comic.community_rating == 4
def test_page_count_property(self, images_dir: Path) -> None:
"""Test that page count returns correct count."""
image_paths = sorted(list(images_dir.iterdir()))[:4]
pages = [PageInfo.load(path=path) for path in image_paths]
comic = ComicInfo.from_pages(pages=pages, title='Count Test')
assert len(comic.pages) == 4
def test_empty_pages_list(self) -> None:
"""Test creating comic with empty pages list."""
comic = ComicInfo.from_pages(pages=[], title='Empty Test')
assert comic.title == 'Empty Test'
assert len(comic.pages) == 0
def test_single_page_comic_load(self, images_dir):
"""Test loading comic with a single page."""
image_paths = sorted(list(images_dir.iterdir()))[:1]
pages = [PageInfo.load(path=path) for path in image_paths]
comic = ComicInfo.from_pages(pages=pages, title="Single Page Test")
with tempfile.TemporaryDirectory() as temp_dir:
temp_path = Path(temp_dir) / "single_page.cbz"
data = comic.pack()
with open(temp_path, "wb") as f:
f.write(data)
assert temp_path.exists()
comic_loaded = ComicInfo.from_cbz(temp_path)
assert comic_loaded.title == "Single Page Test"
assert len(comic_loaded.pages) == 1
+265
View File
@@ -0,0 +1,265 @@
from cbz.models import BaseModel, ComicModel, PageModel
from cbz.constants import Format, YesNo, Manga, AgeRating, PageType
class TestBaseModel:
"""Test cases for BaseModel class."""
def test_base_model_creation(self) -> None:
"""Test creating BaseModel with fields."""
test_fields = {
'test_str': ('Test String', str),
'test_int': ('Test Integer', int),
'test_bool': ('Test Boolean', bool)
}
model = BaseModel(fields=test_fields)
# Check default values are set
assert hasattr(model, 'test_str')
assert hasattr(model, 'test_int')
assert hasattr(model, 'test_bool')
def test_base_model_with_kwargs(self) -> None:
"""Test creating BaseModel with keyword arguments."""
test_fields = {
'title': ('Title', str),
'number': ('Number', int),
'published': ('Published', bool)
}
model = BaseModel(
fields=test_fields,
title='Test Title',
number=42,
published=True
)
assert model.title == 'Test Title'
assert model.number == 42
assert model.published
def test_attribute_type_verification(self) -> None:
"""Test that attribute types are verified on assignment."""
test_fields = {
'count': ('Count', int),
'name': ('Name', str)
}
model = BaseModel(fields=test_fields)
# Valid assignments
model.count = 10
model.name = 'Test'
assert model.count == 10
assert model.name == 'Test'
def test_repr_method(self) -> None:
"""Test string representation of BaseModel."""
test_fields = {
'title': ('Title', str)
}
model = BaseModel(fields=test_fields, title='Test')
repr_str = repr(model)
assert isinstance(repr_str, str)
assert 'BaseModel' in repr_str
class TestComicModel:
"""Test cases for ComicModel class."""
def test_comic_model_creation(self) -> None:
"""Test creating ComicModel with default values."""
model = ComicModel()
# Check that comic-specific attributes exist
assert hasattr(model, 'title')
assert hasattr(model, 'series')
assert hasattr(model, 'number')
assert hasattr(model, 'volume')
assert hasattr(model, 'year')
assert hasattr(model, 'month')
assert hasattr(model, 'day')
def test_comic_model_with_values(self) -> None:
"""Test creating ComicModel with specific values."""
model = ComicModel(
title='Test Comic',
series='Test Series',
number=1,
volume=1,
year=2024,
month=6,
day=15,
writer='Test Writer',
publisher='Test Publisher',
language_iso='en',
format=Format.SERIES,
black_white=YesNo.NO,
manga=Manga.RIGHT_LEFT,
age_rating=AgeRating.EVERYONE
)
assert model.title == 'Test Comic'
assert model.series == 'Test Series'
assert model.number == 1
assert model.volume == 1
assert model.year == 2024
assert model.month == 6
assert model.day == 15
assert model.writer == 'Test Writer'
assert model.publisher == 'Test Publisher'
assert model.language_iso == 'en'
assert model.format == Format.SERIES
assert model.black_white == YesNo.NO
assert model.manga == Manga.RIGHT_LEFT
assert model.age_rating == AgeRating.EVERYONE
def test_comic_model_enum_properties(self) -> None:
"""Test that enum properties work correctly."""
model = ComicModel()
# Test format enum
model.format = Format.PREVIEW
assert model.format == Format.PREVIEW
# Test yes/no enum
model.black_white = YesNo.YES
assert model.black_white == YesNo.YES
# Test manga enum
model.manga = Manga.RIGHT_LEFT
assert model.manga == Manga.RIGHT_LEFT
# Test age rating enum
model.age_rating = AgeRating.TEEN
assert model.age_rating == AgeRating.TEEN
def test_comic_model_metadata_fields(self) -> None:
"""Test comic metadata fields."""
model = ComicModel(
summary='Test summary',
notes='Test notes',
genre='Adventure',
web='http://example.com',
ean='1234567890123',
community_rating=5,
main_character_or_team='Hero',
characters='Hero, Villain',
teams='Justice League',
locations='Metropolis',
scan_information='Scanned by Test',
story_arc='Origin Story',
series_group='DC Comics',
alternate_series='Alternate Universe',
alternate_number=2,
alternate_count=10
)
assert model.summary == 'Test summary'
assert model.notes == 'Test notes'
assert model.genre == 'Adventure'
assert model.web == 'http://example.com'
assert model.ean == '1234567890123'
assert model.community_rating == 5
assert model.main_character_or_team == 'Hero'
assert model.characters == 'Hero, Villain'
assert model.teams == 'Justice League'
assert model.locations == 'Metropolis'
assert model.scan_information == 'Scanned by Test'
assert model.story_arc == 'Origin Story'
assert model.series_group == 'DC Comics'
assert model.alternate_series == 'Alternate Universe'
assert model.alternate_number == 2
assert model.alternate_count == 10
class TestPageModel:
"""Test cases for PageModel class."""
def test_page_model_creation(self) -> None:
"""Test creating PageModel with default values."""
model = PageModel()
# Check that page-specific attributes exist
assert hasattr(model, 'image')
assert hasattr(model, 'type')
assert hasattr(model, 'double')
assert hasattr(model, 'image_size')
assert hasattr(model, 'key')
assert hasattr(model, 'bookmark')
assert hasattr(model, 'image_width')
assert hasattr(model, 'image_height')
assert hasattr(model, 'image_size')
# Note: format is not a base field in PageModel
def test_page_model_with_values(self) -> None:
"""Test creating PageModel with specific values."""
model = PageModel(
type=PageType.FRONT_COVER,
double=True,
image_size=1024000,
key='cover',
bookmark='Chapter 1',
image_width=800,
image_height=1200,
)
assert model.type == PageType.FRONT_COVER
assert model.double
assert model.image_size == 1024000
assert model.key == 'cover'
assert model.bookmark == 'Chapter 1'
assert model.image_width == 800
assert model.image_height == 1200
def test_page_model_page_types(self) -> None:
"""Test different page types."""
page_types = [
PageType.FRONT_COVER,
PageType.INNER_COVER,
PageType.ROUNDUP,
PageType.STORY,
PageType.ADVERTISEMENT,
PageType.EDITORIAL,
PageType.LETTERS,
PageType.PREVIEW,
PageType.BACK_COVER,
PageType.OTHER,
PageType.DELETED
]
for page_type in page_types:
model = PageModel(type=page_type)
assert model.type == page_type
def test_page_model_boolean_properties(self) -> None:
"""Test boolean properties in PageModel."""
model = PageModel()
# Test double property
model.double = True
assert model.double
model.double = False
assert not model.double
def test_page_model_numeric_properties(self) -> None:
"""Test numeric properties in PageModel."""
model = PageModel(
image_size=2048000,
image_width=1920,
image_height=1080
)
assert model.image_size == 2048000
assert model.image_width == 1920
assert model.image_height == 1080
# Test that they're integers
assert isinstance(model.image_size, int)
assert isinstance(model.image_width, int)
assert isinstance(model.image_height, int)
+143
View File
@@ -0,0 +1,143 @@
from pathlib import Path
import pytest
from cbz.page import PageInfo
from cbz.constants import PageType
class TestPageInfo:
"""Test cases for PageInfo class."""
def test_load_from_file(self, sample_image_path: Path) -> None:
"""Test loading PageInfo from image file."""
page = PageInfo.load(path=sample_image_path)
assert page is not None
assert isinstance(page.content, bytes)
assert len(page.content) > 0
assert page.name == sample_image_path.name
assert page.image_width > 0
assert page.image_height > 0
assert page.image_size > 0
assert page.suffix is not None
def test_load_with_page_type(self, sample_image_path: Path) -> None:
"""Test loading PageInfo with specific page type."""
page = PageInfo.load(path=sample_image_path, type=PageType.FRONT_COVER)
assert page.type == PageType.FRONT_COVER
def test_load_with_custom_name(self, sample_image_path: Path) -> None:
"""Test loading PageInfo with custom name."""
custom_name = 'custom_page.jpg'
page = PageInfo.load(path=sample_image_path, name=custom_name)
assert page.name == custom_name
def test_page_content_property(self, sample_image_path: Path) -> None:
"""Test page content property getter and setter."""
page = PageInfo.load(path=sample_image_path)
original_content = page.content
# Test getter
assert page.content == original_content
assert isinstance(page.content, bytes)
# Test that content is properly set and metadata extracted
assert page.image_width > 0
assert page.image_height > 0
assert page.image_size > 0
def test_image_metadata_extraction(self, sample_image_path: Path) -> None:
"""Test that image metadata is correctly extracted."""
page = PageInfo.load(path=sample_image_path)
# Check that all image metadata properties are set
assert hasattr(page, 'image_width') and page.image_width > 0
assert hasattr(page, 'image_height') and page.image_height > 0
assert hasattr(page, 'image_size') and page.image_size > 0
assert hasattr(page, 'suffix') and page.suffix is not None
# Verify dimensions make sense for an image
assert isinstance(page.image_width, int)
assert isinstance(page.image_height, int)
assert isinstance(page.image_size, int)
def test_multiple_image_formats(self, images_dir: Path) -> None:
"""Test loading different image formats."""
image_files = list(images_dir.glob('*.jpg'))
if not image_files:
pytest.skip('No image files found in example directory')
for image_path in image_files[:3]: # Test first 3 images
page = PageInfo.load(path=image_path)
assert page is not None
assert isinstance(page.content, bytes)
assert len(page.content) > 0
assert page.image_width > 0
assert page.image_height > 0
assert page.image_size > 0
def test_page_type_assignment(self, sample_image_path: Path) -> None:
"""Test different page type assignments."""
page_types = [
PageType.FRONT_COVER,
PageType.INNER_COVER,
PageType.ROUNDUP,
PageType.STORY,
PageType.ADVERTISEMENT,
PageType.EDITORIAL,
PageType.LETTERS,
PageType.PREVIEW,
PageType.BACK_COVER,
PageType.OTHER,
PageType.DELETED
]
for page_type in page_types:
page = PageInfo.load(path=sample_image_path, type=page_type)
assert page.type == page_type
def test_page_creation_from_bytes(self, sample_image_path: Path) -> None:
"""Test creating PageInfo directly from bytes."""
# Read image file as bytes
with open(sample_image_path, 'rb') as f:
image_bytes = f.read()
# Create page from bytes
page = PageInfo(content=image_bytes, name='test_page.jpg')
assert page.content == image_bytes
assert page.name == 'test_page.jpg'
assert page.image_width > 0
assert page.image_height > 0
assert page.image_size > 0
def test_repr_string(self, sample_image_path: Path) -> None:
"""Test string representation of PageInfo."""
page = PageInfo.load(path=sample_image_path, type=PageType.STORY)
repr_str = repr(page)
assert 'PageInfo' in repr_str
assert isinstance(repr_str, str)
def test_page_bookmark_property(self, sample_image_path: Path) -> None:
"""Test page bookmark property."""
# Test with bookmark
page = PageInfo.load(path=sample_image_path, bookmark='Chapter 1')
assert page.bookmark == 'Chapter 1'
# Test without bookmark
page_no_bookmark = PageInfo.load(path=sample_image_path)
assert hasattr(page_no_bookmark, 'bookmark')
def test_page_double_page_property(self, sample_image_path: Path) -> None:
"""Test page double_page property."""
page = PageInfo.load(path=sample_image_path, double=True)
assert page.double
page_no_double = PageInfo.load(path=sample_image_path)
assert hasattr(page_no_double, 'double')