refactor(app): 将 account_archive 更新为 author_archive

This commit is contained in:
2025-03-21 20:54:57 +08:00
parent c43f3ad23e
commit f332b3fb2d
10 changed files with 30 additions and 19 deletions

View File

@@ -166,6 +166,12 @@ class CLI:
"bool",
_("是否将每个作品的文件储存至单独的文件夹"),
),
(
"--author_archive",
"-aa",
"bool",
_("是否将每个作者的作品储存至单独的文件夹"),
),
("--language", "-l", "choice", _("设置程序语言目前支持zh_CN、en_US")),
("--settings", "-s", "str", _("读取指定配置文件")),
(
@@ -279,6 +285,11 @@ class CLI:
"-fm",
type=bool,
)
@option(
"--author_archive",
"-aa",
type=bool,
)
@option(
"--language",
"-l",

View File

@@ -159,8 +159,8 @@ class Setting(Screen):
),
Checkbox(
_("作者归档保存模式"),
id="account_archive",
value=self.data["account_archive"],
id="author_archive",
value=self.data["author_archive"],
),
classes="horizontal-layout",
),
@@ -234,7 +234,7 @@ class Setting(Screen):
"video_download": self.query_one("#video_download").value,
"live_download": self.query_one("#live_download").value,
"download_record": self.query_one("#download_record").value,
"account_archive": self.query_one("#account_archive").value,
"author_archive": self.query_one("#author_archive").value,
}
)

View File

@@ -103,7 +103,7 @@ class XHS:
live_download=False,
folder_mode=False,
download_record=True,
account_archive=False,
author_archive=False,
language="zh_CN",
read_cookie: int | str = None,
_print: bool = True,
@@ -129,7 +129,7 @@ class XHS:
live_download,
download_record,
folder_mode,
account_archive,
author_archive,
_print,
)
self.html = Html(self.manager)

View File

@@ -63,7 +63,7 @@ class Download:
self.image_download = manager.image_download
self.video_download = manager.video_download
self.live_download = manager.live_download
self.account_archive = manager.account_archive
self.author_archive = manager.author_archive
async def run(
self,
@@ -110,7 +110,7 @@ class Download:
return path, tasks
def __generate_path(self, nickname:str, filename: str):
if self.account_archive:
if self.author_archive:
folder = self.folder.joinpath(nickname)
folder.mkdir(exist_ok=True)
else:

View File

@@ -65,7 +65,7 @@ class Manager:
live_download: bool,
download_record: bool,
folder_mode: bool,
account_archive:bool,
author_archive:bool,
_print: bool,
):
self.root = root
@@ -116,7 +116,7 @@ class Manager:
self.image_download = self.check_bool(image_download, True)
self.video_download = self.check_bool(video_download, True)
self.live_download = self.check_bool(live_download, True)
self.account_archive = self.check_bool(account_archive, False)
self.author_archive = self.check_bool(author_archive, False)
def __check_path(self, path: str) -> Path:
if not path:

View File

@@ -27,7 +27,7 @@ class Settings:
"live_download": False,
"folder_mode": False,
"download_record": True,
"account_archive": False,
"author_archive": False,
"language": "zh_CN",
}
encode = "UTF-8-SIG" if system() == "Windows" else "UTF-8"