Files
manga-dl/packager.py
T

16 lines
446 B
Python

# packager.py
import zipfile
from pathlib import Path
def zip_files(slug, chapter: dict, files: list[Path], save_dir: Path):
save_dir.joinpath(slug).mkdir(parents=True, exist_ok=True)
filename = save_dir.joinpath(slug).joinpath(f"{slug} Ch.{chapter.get('nr'):g}.cbz")
with zipfile.ZipFile(filename, "w") as zf:
for file in files:
zf.write(file, file.name)
zf.close()
return filename