From 0210217d1e50e1cc1e1f8cd642ab40af981e642c Mon Sep 17 00:00:00 2001 From: jxxghp Date: Tue, 8 Aug 2023 13:40:09 +0800 Subject: [PATCH] fix --- app/plugins/autobackup/__init__.py | 7 ++++--- app/plugins/nastoolsync/__init__.py | 9 ++++++--- app/plugins/webhook/__init__.py | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/app/plugins/autobackup/__init__.py b/app/plugins/autobackup/__init__.py index 2b3ca111..9afe51b3 100644 --- a/app/plugins/autobackup/__init__.py +++ b/app/plugins/autobackup/__init__.py @@ -24,7 +24,7 @@ class AutoBackup(_PluginBase): # 插件图标 plugin_icon = "backup.png" # 主题色 - plugin_color = "bg-green" + plugin_color = "#4FB647" # 插件版本 plugin_version = "1.0" # 插件作者 @@ -140,7 +140,8 @@ class AutoBackup(_PluginBase): f"清理备份数量 {del_cnt}\n" f"剩余备份数量 {bk_cnt - del_cnt}") - def backup(self, bk_path=None): + @staticmethod + def backup(bk_path: Path = None): """ @param bk_path 自定义备份路径 """ @@ -148,7 +149,7 @@ class AutoBackup(_PluginBase): # 创建备份文件夹 config_path = Path(settings.CONFIG_PATH) backup_file = f"bk_{time.strftime('%Y%m%d%H%M%S')}" - backup_path = Path(bk_path) / backup_file + backup_path = bk_path / backup_file backup_path.mkdir(parents=True) # 把现有的相关文件进行copy备份 shutil.copy(f'{config_path}/category.yaml', backup_path) diff --git a/app/plugins/nastoolsync/__init__.py b/app/plugins/nastoolsync/__init__.py index 5727e92b..04f65d14 100644 --- a/app/plugins/nastoolsync/__init__.py +++ b/app/plugins/nastoolsync/__init__.py @@ -237,7 +237,8 @@ class NAStoolSync(_PluginBase): logger.info(f"转移记录已同步完成。总耗时 {(end_time - start_time).seconds} 秒") - def get_nt_plugin_history(self, cursor): + @staticmethod + def get_nt_plugin_history(cursor): """ 获取插件历史记录 """ @@ -252,7 +253,8 @@ class NAStoolSync(_PluginBase): logger.info(f"获取到NAStool插件记录 {len(plugin_history)} 条") return plugin_history - def get_nt_download_history(self, cursor): + @staticmethod + def get_nt_download_history(cursor): """ 获取下载历史记录 """ @@ -293,7 +295,8 @@ class NAStoolSync(_PluginBase): logger.info(f"获取到NAStool下载记录 {len(download_history)} 条") return download_history - def get_nt_transfer_history(self, cursor): + @staticmethod + def get_nt_transfer_history(cursor): """ 获取nt转移记录 """ diff --git a/app/plugins/webhook/__init__.py b/app/plugins/webhook/__init__.py index c38f60f9..e1409ffe 100644 --- a/app/plugins/webhook/__init__.py +++ b/app/plugins/webhook/__init__.py @@ -136,9 +136,9 @@ class WebHook(_PluginBase): if not self._webhook_url: return - def __to_dict(event): + def __to_dict(_event): result = {} - for key, value in event.items(): + for key, value in _event.items(): if hasattr(value, 'to_dict'): result[key] = value.to_dict() else: