refactor: unify module runtime settings

This commit is contained in:
jxxghp
2026-08-24 00:19:57 +08:00
parent 25ad924aac
commit 6b65dc5d12
11 changed files with 148 additions and 30 deletions
+7 -1
View File
@@ -4,9 +4,9 @@ from typing import Set, Tuple, Optional, Union, List, Dict
from transmission_rpc import File
from app.schemas.dashboard import DownloaderInfo as _SchemaDownloaderInfo
from app.runtime.config import settings
from app.domain.metainfo import MetaInfo
from app.runtime.log import logger
from app.runtime.settings import RuntimeSettingsCompat
from app.modules._base import _DownloaderModuleBase
from app.modules.transmission.transmission import Transmission
from app.schemas.transfer import DownloaderTorrent
@@ -20,6 +20,8 @@ from app.schemas.types import (
from app.foundation import size as size_tools
from app.foundation import temporal as time_tools
settings = RuntimeSettingsCompat()
_TRANSMISSION_DOWNLOADING_STATES = {
"download_pending",
"downloading",
@@ -30,6 +32,7 @@ _TRANSMISSION_PAUSED_STATES = {
class TransmissionModule(_DownloaderModuleBase[Transmission]):
"""Transmission 下载器模块,负责任务添加、标签和文件选择。"""
def init_module(self) -> None:
"""
@@ -40,6 +43,7 @@ class TransmissionModule(_DownloaderModuleBase[Transmission]):
@staticmethod
def get_name() -> str:
"""返回模块展示名称。"""
return "Transmission"
@staticmethod
@@ -64,9 +68,11 @@ class TransmissionModule(_DownloaderModuleBase[Transmission]):
return 2
def stop(self):
"""下载器客户端由服务基类管理,本模块无额外停止动作。"""
pass
def init_setting(self) -> Tuple[str, Union[str, bool]]:
"""下载器实例由系统配置管理,不声明独立模块开关。"""
pass
def download(self, content: Union[Path, str, bytes], download_dir: Path, cookie: str,