From 7435fb0c10234e083e25dca957242bbb0a2b4f21 Mon Sep 17 00:00:00 2001 From: thsrite Date: Tue, 5 Sep 2023 16:52:02 +0800 Subject: [PATCH] =?UTF-8?q?fix=20tr=E6=96=87=E4=BB=B6=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E6=8E=89=E6=9C=AA=E4=B8=8B=E8=BD=BD=E7=9A=84?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/plugins/syncdownloadfiles/__init__.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/plugins/syncdownloadfiles/__init__.py b/app/plugins/syncdownloadfiles/__init__.py index a912fe04..31cf6ad2 100644 --- a/app/plugins/syncdownloadfiles/__init__.py +++ b/app/plugins/syncdownloadfiles/__init__.py @@ -167,6 +167,9 @@ class SyncDownloadFiles(_PluginBase): download_files = [] for file in torrent_files: + # 过滤掉没下载的文件 + if not self.__is_download(file, downloader): + continue # 种子文件路径 file_path_str = self.__get_file_path(file, downloader) file_path = Path(file_path_str) @@ -282,6 +285,20 @@ class SyncDownloadFiles(_PluginBase): return True + @staticmethod + def __is_download(file: Any, dl_type: str): + """ + 判断文件是否被下载 + """ + try: + if dl_type == "qbittorrent": + return True + else: + return file.completed and file.completed > 0 + except Exception as e: + print(str(e)) + return True + @staticmethod def __get_file_path(file: Any, dl_type: str): """