mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-07 00:16:57 +08:00
fix 重连机制
This commit is contained in:
@@ -33,7 +33,7 @@ class QbittorrentModule(_ModuleBase):
|
||||
定时任务,每10分钟调用一次
|
||||
"""
|
||||
# 定时重连
|
||||
if not self.qbittorrent.qbc:
|
||||
if self.qbittorrent.is_inactive():
|
||||
self.qbittorrent = Qbittorrent()
|
||||
|
||||
def download(self, torrent_path: Path, download_dir: Path, cookie: str,
|
||||
|
||||
@@ -27,6 +27,14 @@ class Qbittorrent(metaclass=Singleton):
|
||||
if self._host and self._port:
|
||||
self.qbc = self.__login_qbittorrent()
|
||||
|
||||
def is_inactive(self) -> bool:
|
||||
"""
|
||||
判断是否需要重连
|
||||
"""
|
||||
if not self._host or not self._port:
|
||||
return False
|
||||
return True if not self.qbc else False
|
||||
|
||||
def __login_qbittorrent(self) -> Optional[Client]:
|
||||
"""
|
||||
连接qbittorrent
|
||||
|
||||
Reference in New Issue
Block a user