bump version

This commit is contained in:
hyugogirubato
2026-04-06 15:01:01 +02:00
parent 0ecf0f843b
commit 95472d4ac4
20 changed files with 2198 additions and 1461 deletions
+36 -31
View File
@@ -1,59 +1,64 @@
"""Usage example for the CBZ library."""
from pathlib import Path
from cbz.comic import ComicInfo
from cbz.constants import PageType, YesNo, Manga, AgeRating, Format
from cbz.page import PageInfo
from cbz import ComicInfo, PageInfo, PageType, Format, YesNo, Manga, AgeRating
PARENT = Path(__file__).parent
if __name__ == '__main__':
paths = list((PARENT / 'fixtures' / 'images').iterdir())
if __name__ == "__main__":
paths = sorted((PARENT / "fixtures" / "images").iterdir())
# Load each page from the 'images' folder into a list of PageInfo objects
# Load pages with automatic type assignment
pages = [
PageInfo.load(
path=path,
type=PageType.FRONT_COVER if i == 0 else PageType.BACK_COVER if i == len(paths) - 1 else PageType.STORY
type=(
PageType.FRONT_COVER if i == 0
else PageType.BACK_COVER if i == len(paths) - 1
else PageType.STORY
),
)
for i, path in enumerate(paths)
]
# Create a ComicInfo object using ComicInfo.from_pages() method
# Create comic with metadata
comic = ComicInfo.from_pages(
pages=pages,
title='T1 - Arrête de me chauffer, Nagatoro',
series='Arrête de me chauffer, Nagatoro',
title="T1 - Arrête de me chauffer, Nagatoro",
series="Arrête de me chauffer, Nagatoro",
number=1,
count=8,
volume=1,
summary='Nagatoro est en seconde. Pleine d\u2019assurance, joueuse, moqueuse, elle se d\u00e9couvre un jour un passe-temps favori : martyriser son \u201cSenpai\u201d, lyc\u00e9en de premi\u00e8re timide et mal dans sa peau. Nagatoro taquine, agace, aguiche, va parfois trop loin... mais qu\u2019a-t-elle vraiment derri\u00e8re la t\u00eate ? Et si derri\u00e8re ses moqueries elle cachait une v\u00e9ritable affection ? Et si finalement, ses farces permettaient \u00e0 Senpai de s\u2019affirmer ?',
summary="Nagatoro est en seconde. Pleine d\u2019assurance, joueuse, moqueuse, elle se d\u00e9couvre un jour un passe-temps favori : martyriser son \u201cSenpai\u201d, lyc\u00e9en de premi\u00e8re timide et mal dans sa peau. Nagatoro taquine, agace, aguiche, va parfois trop loin... mais qu\u2019a-t-elle vraiment derri\u00e8re la t\u00eate ? Et si derri\u00e8re ses moqueries elle cachait une v\u00e9ritable affection ? Et si finalement, ses farces permettaient \u00e0 Senpai de s\u2019affirmer ?",
year=2021,
month=3,
day=12,
writer='Nanashi',
inker='Nanashi',
editor='Noeve Grafx',
publisher='Noeve Grafx',
imprint='Noeve Grafx',
genre='Shonen',
web='http://www.izneo.com/en/manga/shonen/arrete-de-me-chauffer-nagatoro-37560/arrete-de-me-chauffer-nagatoro-86232',
language_iso='fr',
writer="Nanashi",
inker="Nanashi",
editor="Noeve Grafx",
publisher="Noeve Grafx",
imprint="Noeve Grafx",
genre="Shonen",
web="http://www.izneo.com/en/manga/shonen/arrete-de-me-chauffer-nagatoro-37560/arrete-de-me-chauffer-nagatoro-86232",
language_iso="fr",
format=Format.PREVIEW,
black_white=YesNo.YES,
manga=Manga.RIGHT_LEFT,
age_rating=AgeRating.EVERYONE10,
manga=Manga.YES_AND_RIGHT_TO_LEFT,
age_rating=AgeRating.EVERYONE_10_PLUS,
community_rating=5,
ean='9782490676569'
ean="9782490676569",
)
# Show the comic using the show()
# Use the sequence protocol
print(f"Number of pages: {len(comic)}")
for i, page in enumerate(comic):
print(f" Page {i}: {page.image_width}x{page.image_height} ({page.type})")
# Display in the built-in reader
comic.show()
# Pack the comic book content into a CBZ file format
cbz_content = comic.pack(rename=True)
# Define the path where the CBZ file will be saved
cbz_path = PARENT / f'{comic.title}.cbz'
# Write the CBZ content to the specified path
cbz_path.write_bytes(cbz_content)
# Save as CBZ
cbz_path = PARENT / f"{comic.title}.cbz"
comic.save(cbz_path)
print(f"Saved: {cbz_path}")