fix downloaders

This commit is contained in:
jxxghp
2024-07-02 11:00:55 +08:00
parent dfc5872087
commit c8fe6e4284
19 changed files with 311 additions and 140 deletions
+8 -5
View File
@@ -1,4 +1,7 @@
from typing import List
from app.db.systemconfig_oper import SystemConfigOper
from app.schemas.system import DownloaderConf
from app.schemas.types import SystemConfigKey
@@ -10,11 +13,11 @@ class DownloaderHelper:
def __init__(self):
self.systemconfig = SystemConfigOper()
def get_downloaders(self) -> dict:
def get_downloaders(self) -> List[DownloaderConf]:
"""
获取下载器
"""
downloader_conf: dict = self.systemconfig.get(SystemConfigKey.Downloaders)
if not downloader_conf:
return {}
return downloader_conf
downloader_confs: List[dict] = self.systemconfig.get(SystemConfigKey.Downloaders)
if not downloader_confs:
return []
return [DownloaderConf(**conf) for conf in downloader_confs]