"""核心数据模型"""
from dataclasses import dataclass, field
from pathlib import Path
@dataclass
class PageImage:
"""单页图片"""
chapter_id: str
page_number: int
url: str
local_path: str | None = None
@dataclass
class Chapter:
"""漫画章节"""
id: str
title: str
chapter_number: float
url: str
page_count: int | None = None
chapter_type: str = "chapter" # volume | chapter | extra
@dataclass
class MangaInfo:
"""漫画信息"""
id: str
title: str
source: str
url: str
alt_title: str | None = None
author: str | None = None
cover_url: str | None = None
description: str | None = None
tags: list[str] = field(default_factory=list)
chapters: list[Chapter] = field(default_factory=list)
@dataclass
class ChapterResult:
"""单章节下载结果"""
chapter: Chapter
status: str # downloaded | partial | failed | skipped
pages_total: int
pages_downloaded: int
download_path: Path | None = None
@dataclass
class DownloadResult:
"""多章节下载结果"""
manga: MangaInfo
chapters_total: int
chapters_downloaded: int = 0
chapters_skipped: int = 0
chapters_failed: int = 0
chapter_results: list[ChapterResult] = field(default_factory=list)