feat(image): 增加对 JPEG 和 HEIC 图片格式的支持

- 在图片下载功能中添加了对 JPEG 和 HEIC 格式的支持
- 更新了相关模块和文档以支持新功能

Closes #229
This commit is contained in:
2025-02-18 19:55:12 +08:00
parent 1570ba320c
commit 7059603d46
10 changed files with 39 additions and 24 deletions

View File

@@ -29,6 +29,7 @@ from .static import (
FILE_SIGNATURES,
FILE_SIGNATURES_LENGTH,
MAX_WORKERS,
__VERSION__,
)
from .tools import (
retry,

View File

@@ -138,8 +138,8 @@ class Manager:
@staticmethod
def __check_image_format(image_format) -> str:
if image_format in {"png", "PNG", "webp", "WEBP"}:
return image_format.lower()
if (i := image_format.lower()) in {"auto", "png", "webp", "jpeg", "heic", "avif", }:
return i
return "png"
@staticmethod

View File

@@ -3,7 +3,7 @@ from pathlib import Path
VERSION_MAJOR = 2
VERSION_MINOR = 5
VERSION_BETA = True
__version__ = f"{VERSION_MAJOR}.{VERSION_MINOR}.{'beta' if VERSION_BETA else 'stable'}"
__VERSION__ = f"{VERSION_MAJOR}.{VERSION_MINOR}.{'beta' if VERSION_BETA else 'stable'}"
ROOT = Path(__file__).resolve().parent.parent.parent
PROJECT = f"XHS-Downloader V{VERSION_MAJOR}.{VERSION_MINOR} {
'Beta' if VERSION_BETA else 'Stable'
@@ -68,4 +68,4 @@ FILE_SIGNATURES_LENGTH = max(
MAX_WORKERS: int = 4
if __name__ == "__main__":
print(__version__)
print(__VERSION__)