From a3a8fb3217543dfd430470691d2a3ca4bef81555 Mon Sep 17 00:00:00 2001 From: thsrite Date: Tue, 2 Jan 2024 14:23:59 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E8=B1=86=E7=93=A3=E6=98=8E=E6=98=9F?= =?UTF-8?q?=E7=83=AD=E6=98=A0=E8=AE=A2=E9=98=85=E5=A2=9E=E5=8A=A0=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=8E=86=E5=8F=B2=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/actorsubscribe/__init__.py | 38 +++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/plugins/actorsubscribe/__init__.py b/plugins/actorsubscribe/__init__.py index e83c1a4..17194fa 100644 --- a/plugins/actorsubscribe/__init__.py +++ b/plugins/actorsubscribe/__init__.py @@ -43,6 +43,7 @@ class ActorSubscribe(_PluginBase): _quality = None _resolution = None _effect = None + _clear = False # 质量选择框数据 _qualityOptions = { '全部': '', @@ -86,6 +87,7 @@ class ActorSubscribe(_PluginBase): self._quality = config.get("quality") self._resolution = config.get("resolution") self._effect = config.get("effect") + self._clear = config.get("_clear") if self._enabled or self._onlyonce: # 定时服务 @@ -128,8 +130,12 @@ class ActorSubscribe(_PluginBase): logger.warn("暂无订阅明星,停止运行") return - history: List[dict] = self.get_data('history') or [] - already_handle: List[dict] = self.get_data('already_handle') or [] + if self._clear: + history: List[dict] = [] + already_handle: List[dict] = [] + else: + history: List[dict] = self.get_data('history') or [] + already_handle: List[dict] = self.get_data('already_handle') or [] movies = DoubanChain().movie_showing(page=1, count=100) if not movies: @@ -182,6 +188,9 @@ class ActorSubscribe(_PluginBase): self.save_data('history', history) self.save_data('already_handle', already_handle) + self._clear = False + self.__update_config() + def __update_config(self): self.update_config({ "enabled": self._enabled, @@ -190,7 +199,8 @@ class ActorSubscribe(_PluginBase): "actors": self._actors, "quality": self._quality, "resolution": self._resolution, - "effect": self._effect + "effect": self._effect, + "clear": self._clear, }) def get_state(self) -> bool: @@ -354,6 +364,27 @@ class ActorSubscribe(_PluginBase): }, ] }, + { + 'component': 'VRow', + 'content': [ + { + 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 6 + }, + 'content': [ + { + 'component': 'VSwitch', + 'props': { + 'model': 'clear', + 'label': '清理历史记录', + } + } + ] + } + ] + } ] } ], { @@ -364,6 +395,7 @@ class ActorSubscribe(_PluginBase): "quality": "", "resolution": "", "effect": "", + "clear": False } def get_page(self) -> List[dict]: