diff --git a/app/modules/emby/emby.py b/app/modules/emby/emby.py index e7b52a62..24c4f896 100644 --- a/app/modules/emby/emby.py +++ b/app/modules/emby/emby.py @@ -15,6 +15,11 @@ from app.utils.http import RequestUtils class Emby: + _host: str = None + _playhost: str = None + _apikey: str = None + user: Optional[Union[str, int]] = None + def __init__(self, host: str = None, apikey: str = None, play_host: str = None, **kwargs): if not host or not apikey: logger.error("Emby服务器配置不完整!") diff --git a/app/modules/jellyfin/jellyfin.py b/app/modules/jellyfin/jellyfin.py index 2c530e35..6fecde46 100644 --- a/app/modules/jellyfin/jellyfin.py +++ b/app/modules/jellyfin/jellyfin.py @@ -12,6 +12,11 @@ from app.utils.http import RequestUtils class Jellyfin: + _host: str = None + _apikey: str = None + _playhost: str = None + user: Optional[Union[str, int]] = None + def __init__(self, host: str = None, apikey: str = None, play_host: str = None, **kwargs): if not host or not apikey: logger.error("Jellyfin服务器配置不完整!!") diff --git a/app/modules/qbittorrent/__init__.py b/app/modules/qbittorrent/__init__.py index 62445332..111e28c4 100644 --- a/app/modules/qbittorrent/__init__.py +++ b/app/modules/qbittorrent/__init__.py @@ -276,7 +276,7 @@ class QbittorrentModule(_ModuleBase, _DownloaderBase): return None server.set_torrents_tag(ids=hashs, tags=['已整理']) # 移动模式删除种子 - if settings.TRANSFER_TYPE in ["move", "rclone_move"]: + if settings.TRANSFER_TYPE in ["move"]: if self.remove_torrents(hashs): logger.info(f"移动模式删除种子成功:{hashs} ") # 删除残留文件 diff --git a/app/modules/qbittorrent/qbittorrent.py b/app/modules/qbittorrent/qbittorrent.py index aba0cf8f..b46d4837 100644 --- a/app/modules/qbittorrent/qbittorrent.py +++ b/app/modules/qbittorrent/qbittorrent.py @@ -6,7 +6,6 @@ from qbittorrentapi import TorrentDictionary, TorrentFilesList from qbittorrentapi.client import Client from qbittorrentapi.transfer import TransferInfoDictionary -from app.core.config import settings from app.log import logger @@ -15,17 +14,36 @@ class Qbittorrent: _port: int = None _username: str = None _password: str = None + _category: bool = False + _sequentail: bool = False + _force_resume: bool = False qbc: Client = None - def __init__(self, host: str = None, port: int = None, username: str = None, password: str = None, **kwargs): + def __init__(self, host: str = None, port: int = None, + username: str = None, password: str = None, + category: bool = False, sequentail: bool = False, force_resume: bool = False, + **kwargs): """ 若不设置参数,则创建配置文件设置的下载器 """ + if not host: + logger.error("Qbittorrent配置不完整!") + return self._host = host - self._port = port + if not port: + # 从host中获取端口 + if ":" in host: + host, port = host.split(":") + self._host = host + self._port = int(port) + else: + self._port = port self._username = username self._password = password + self._category = category + self._sequentail = sequentail + self._force_resume = force_resume if self._host and self._port: self.qbc = self.__login_qbittorrent() @@ -246,7 +264,7 @@ class Qbittorrent: tags = None # 分类自动管理 - if category and settings.QB_CATEGORY: + if category and self._category: is_auto = True else: is_auto = False @@ -260,7 +278,7 @@ class Qbittorrent: is_paused=is_paused, tags=tags, use_auto_torrent_management=is_auto, - is_sequential_download=settings.QB_SEQUENTIAL, + is_sequential_download=self._sequentail, cookie=cookie, category=category, **kwargs) diff --git a/app/modules/transmission/__init__.py b/app/modules/transmission/__init__.py index ad579fe8..6cd0d8b1 100644 --- a/app/modules/transmission/__init__.py +++ b/app/modules/transmission/__init__.py @@ -271,7 +271,7 @@ class TransmissionModule(_ModuleBase, _DownloaderBase): tags = ['已整理'] server.set_torrent_tag(ids=hashs, tags=tags) # 移动模式删除种子 - if settings.TRANSFER_TYPE in ["move", "rclone_move"]: + if settings.TRANSFER_TYPE in ["move"]: if self.remove_torrents(hashs): logger.info(f"移动模式删除种子成功:{hashs} ") # 删除残留文件 diff --git a/app/modules/transmission/transmission.py b/app/modules/transmission/transmission.py index cda91b95..ee1f12bc 100644 --- a/app/modules/transmission/transmission.py +++ b/app/modules/transmission/transmission.py @@ -22,15 +22,22 @@ class Transmission: "peersGettingFromUs", "peersSendingToUs", "uploadRatio", "uploadedEver", "downloadedEver", "downloadDir", "error", "errorString", "doneDate", "queuePosition", "activityDate", "trackers"] - def __init__(self, host: str, port: int, username: str = None, password: str = None, **kwargs): + def __init__(self, host: str = None, port: int = None, username: str = None, password: str = None, **kwargs): """ 若不设置参数,则创建配置文件设置的下载器 """ - if not host or not port: + if not host: logger.error("Transmission配置不完整!") return self._host = host - self._port = port + if not port: + # 从host中获取端口 + if ":" in host: + host, port = host.split(":") + self._host = host + self._port = int(port) + else: + self._port = port self._username = username self._password = password if self._host and self._port: