The only downloader you need. 下载器的集大成者。
TypeScript asyncasynciobittorentbtcross-platformdownload-managerdownloaderfluent-designftphttp3magnetpyqtpyside6pythonqtquicreactsoftwarestreaming
fix(category): 草稿卡片显示自动匹配的分类
XiaoYouChR5610e6e42678
diff --git a/GLOSSARY.md b/GLOSSARY.mdindex 9ad4b5a5..70055b20 100644--- a/GLOSSARY.md+++ b/GLOSSARY.md@@ -261,6 +261,7 @@ _Avoid_: 用绑定端口或任务句柄推断是否在监听**Category**:下载分类和目标目录规则。将文件扩展名匹配到分类并解析下载目录。+任务未指定分类时按扩展名自动匹配;未分类指用户明确不分类,或自动匹配不到任何分类。_Avoid_: group、tag、type**Coroutine Runner**:diff --git a/app/services/category_service.py b/app/services/category_service.pyindex a34f5466..5b481545 100644--- a/app/services/category_service.py+++ b/app/services/category_service.py@@ -171,6 +171,8 @@ class CategoryService:return ""def categoryOf(self, task: Task) -> str:+ if task.category is not None:+ return task.categoryif task.isOutputFolder:return ""return self.matchByName(task.name)@@ -184,9 +186,7 @@ class CategoryService:def outputFolderOf(self, task: Task) -> tuple[str | None, Path]:if not cfg.isCategoryEnabled.value:return task.category, task.outputFolder- categoryId = task.category- if categoryId is None:- categoryId = self.categoryOf(task)+ categoryId = self.categoryOf(task)folder = task.outputFolderif categoryId and folder == Path(cfg.downloadFolder.value):folder = Path(self.folderOf(categoryId) or folder)diff --git a/app/view/cards/draft_cards.py b/app/view/cards/draft_cards.pyindex e4cbc015..024daa02 100644--- a/app/view/cards/draft_cards.py+++ b/app/view/cards/draft_cards.py@@ -115,6 +115,7 @@ class DraftCard(QWidget):self.nameLabel.setText(self._task.name)self.nameEdit.setText(self._task.name)self._refreshFileIcon()+ self._refreshCategoryButton()self._refreshConflictIcon()self.nameEdit.hide()self.nameLabel.show()@@ -123,7 +124,7 @@ class DraftCard(QWidget):if not cfg.isCategoryEnabled.value:self.categoryButton.hide()return- category = self._categoryService.categoryById(self._task.category)+ category = self._categoryService.categoryById(self._categoryService.categoryOf(self._task))if category:self.categoryButton.setIcon(getattr(FluentIcon, category.icon, FluentIcon.TAG))self.categoryButton.setToolTip(toCategoryName(category))