From 27b1e0ffd5fe75c46cc493eac05a938147e1e05e Mon Sep 17 00:00:00 2001 From: jxxghp Date: Wed, 27 Sep 2023 09:47:56 +0800 Subject: [PATCH 1/6] fix #668 rollback #654 --- app/utils/system.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/utils/system.py b/app/utils/system.py index 2c4e13a9..6c3d0ccd 100644 --- a/app/utils/system.py +++ b/app/utils/system.py @@ -349,9 +349,9 @@ class SystemUtils: # 获取当前容器的 ID with open('/proc/self/mountinfo', 'r') as f: data = f.read() - index_resolv_conf = data.find("/sys/fs/cgroup/devices") + index_resolv_conf = data.find("resolv.conf") if index_resolv_conf != -1: - index_second_slash = data.rfind(" ", 0, index_resolv_conf) + index_second_slash = data.rfind("/", 0, index_resolv_conf) index_first_slash = data.rfind("/", 0, index_second_slash) + 1 container_id = data[index_first_slash:index_second_slash] if not container_id: From 3a2765676935af992dc9bc278309bd4e4d83509a Mon Sep 17 00:00:00 2001 From: jxxghp Date: Wed, 27 Sep 2023 10:18:40 +0800 Subject: [PATCH 2/6] fix #557 --- app/api/endpoints/site.py | 2 +- app/api/endpoints/subscribe.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api/endpoints/site.py b/app/api/endpoints/site.py index c7876d0e..ace1f049 100644 --- a/app/api/endpoints/site.py +++ b/app/api/endpoints/site.py @@ -31,7 +31,7 @@ def read_sites(db: Session = Depends(get_db), @router.post("/", summary="新增站点", response_model=schemas.Response) -def update_site( +def add_site( *, db: Session = Depends(get_db), site_in: schemas.Site, diff --git a/app/api/endpoints/subscribe.py b/app/api/endpoints/subscribe.py index fcf22a25..ef46619c 100644 --- a/app/api/endpoints/subscribe.py +++ b/app/api/endpoints/subscribe.py @@ -88,7 +88,7 @@ def update_subscribe( subscribe = Subscribe.get(db, subscribe_in.id) if not subscribe: return schemas.Response(success=False, message="订阅不存在") - if subscribe_in.sites: + if subscribe_in.sites is not None: subscribe_in.sites = json.dumps(subscribe_in.sites) # 避免更新缺失集数 subscribe_dict = subscribe_in.dict() From 71ce3a292038a937a33151d6ffc51dd6f28e9b4e Mon Sep 17 00:00:00 2001 From: jxxghp Date: Wed, 27 Sep 2023 10:19:37 +0800 Subject: [PATCH 3/6] v1.2.6 --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index 90edc7fa..2d53190a 100644 --- a/version.py +++ b/version.py @@ -1 +1 @@ -APP_VERSION = 'v1.2.5' +APP_VERSION = 'v1.2.6' From 404a7b83376eab4b6299f937e79f629396449949 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Wed, 27 Sep 2023 11:14:56 +0800 Subject: [PATCH 4/6] fix bug --- app/plugins/brushflow/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/plugins/brushflow/__init__.py b/app/plugins/brushflow/__init__.py index 63a380c4..3c355340 100644 --- a/app/plugins/brushflow/__init__.py +++ b/app/plugins/brushflow/__init__.py @@ -1265,12 +1265,6 @@ class BrushFlow(_PluginBase): f"{task.get('site_name')}{task.get('title')}" for task in task_info.values() ]: continue - # 保种体积(GB) 促销 - if self._disksize \ - and (torrents_size + torrent.size) > float(self._disksize) * 1024**3: - logger.warn(f"当前做种体积 {StringUtils.str_filesize(torrents_size)} " - f"已超过保种体积 {self._disksize},停止新增任务") - break # 促销 if self._freeleech and torrent.downloadvolumefactor != 0: continue @@ -1349,6 +1343,12 @@ class BrushFlow(_PluginBase): logger.warn(f"当前总下载带宽 {StringUtils.str_filesize(current_download_speed)} " f"已达到最大值 {self._maxdlspeed} KB/s,暂时停止新增任务") break + # 保种体积(GB) + if self._disksize \ + and (torrents_size + torrent.size) > float(self._disksize) * 1024**3: + logger.warn(f"当前做种体积 {StringUtils.str_filesize(torrents_size)} " + f"已超过保种体积 {self._disksize},停止新增任务") + break # 添加下载任务 hash_string = self.__download(torrent=torrent) if not hash_string: From f5a61ceff1b66b2c597736f0b8bf2b724c6a5f5a Mon Sep 17 00:00:00 2001 From: jxxghp Date: Wed, 27 Sep 2023 13:40:35 +0800 Subject: [PATCH 5/6] fix bug --- app/plugins/brushflow/__init__.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/app/plugins/brushflow/__init__.py b/app/plugins/brushflow/__init__.py index 3c355340..6f1d557e 100644 --- a/app/plugins/brushflow/__init__.py +++ b/app/plugins/brushflow/__init__.py @@ -1767,19 +1767,22 @@ class BrushFlow(_PluginBase): """ 发送删除种子的消息 """ - if self._notify: - self.chain.post_message(Notification( - mtype=NotificationType.SiteMessage, - title=f"【刷流任务删种】", - text=f"站点:{site_name}\n" - f"标题:{torrent_title}\n" - f"原因:{reason}" - )) + if not self._notify: + return + self.chain.post_message(Notification( + mtype=NotificationType.SiteMessage, + title=f"【刷流任务删种】", + text=f"站点:{site_name}\n" + f"标题:{torrent_title}\n" + f"原因:{reason}" + )) def __send_add_message(self, torrent: TorrentInfo): """ 发送添加下载的消息 """ + if not self._notify: + return msg_text = "" if torrent.site_name: msg_text = f"站点:{torrent.site_name}" From 81d9d3902986374ec82b722952bca856666a1cbb Mon Sep 17 00:00:00 2001 From: jxxghp Date: Wed, 27 Sep 2023 14:12:11 +0800 Subject: [PATCH 6/6] fix bug --- app/plugins/brushflow/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/plugins/brushflow/__init__.py b/app/plugins/brushflow/__init__.py index 6f1d557e..4dcf2e31 100644 --- a/app/plugins/brushflow/__init__.py +++ b/app/plugins/brushflow/__init__.py @@ -120,6 +120,9 @@ class BrushFlow(_PluginBase): self.save_data("statistic", {}) # 清除种子记录 self.save_data("torrents", {}) + # 关闭一次性开关 + self._clear_task = False + self.__update_config() # 停止现有任务 self.stop_service() @@ -729,6 +732,7 @@ class BrushFlow(_PluginBase): "enabled": False, "notify": True, "onlyonce": False, + "clear_task": False, "freeleech": "free" } @@ -1218,7 +1222,8 @@ class BrushFlow(_PluginBase): "seed_inactivetime": self._seed_inactivetime, "up_speed": self._up_speed, "dl_speed": self._dl_speed, - "save_path": self._save_path + "save_path": self._save_path, + "clear_task": self._clear_task }) def brush(self):