mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-04 23:17:20 +08:00
refactor: unify module runtime settings
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user