This commit is contained in:
jxxghp 2023-08-08 13:40:09 +08:00
parent 3f8c5fbf48
commit 0210217d1e
3 changed files with 12 additions and 8 deletions

View File

@ -24,7 +24,7 @@ class AutoBackup(_PluginBase):
# 插件图标 # 插件图标
plugin_icon = "backup.png" plugin_icon = "backup.png"
# 主题色 # 主题色
plugin_color = "bg-green" plugin_color = "#4FB647"
# 插件版本 # 插件版本
plugin_version = "1.0" plugin_version = "1.0"
# 插件作者 # 插件作者
@ -140,7 +140,8 @@ class AutoBackup(_PluginBase):
f"清理备份数量 {del_cnt}\n" f"清理备份数量 {del_cnt}\n"
f"剩余备份数量 {bk_cnt - del_cnt}") f"剩余备份数量 {bk_cnt - del_cnt}")
def backup(self, bk_path=None): @staticmethod
def backup(bk_path: Path = None):
""" """
@param bk_path 自定义备份路径 @param bk_path 自定义备份路径
""" """
@ -148,7 +149,7 @@ class AutoBackup(_PluginBase):
# 创建备份文件夹 # 创建备份文件夹
config_path = Path(settings.CONFIG_PATH) config_path = Path(settings.CONFIG_PATH)
backup_file = f"bk_{time.strftime('%Y%m%d%H%M%S')}" 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) backup_path.mkdir(parents=True)
# 把现有的相关文件进行copy备份 # 把现有的相关文件进行copy备份
shutil.copy(f'{config_path}/category.yaml', backup_path) shutil.copy(f'{config_path}/category.yaml', backup_path)

View File

@ -237,7 +237,8 @@ class NAStoolSync(_PluginBase):
logger.info(f"转移记录已同步完成。总耗时 {(end_time - start_time).seconds}") 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)}") logger.info(f"获取到NAStool插件记录 {len(plugin_history)}")
return 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)}") logger.info(f"获取到NAStool下载记录 {len(download_history)}")
return download_history return download_history
def get_nt_transfer_history(self, cursor): @staticmethod
def get_nt_transfer_history(cursor):
""" """
获取nt转移记录 获取nt转移记录
""" """

View File

@ -136,9 +136,9 @@ class WebHook(_PluginBase):
if not self._webhook_url: if not self._webhook_url:
return return
def __to_dict(event): def __to_dict(_event):
result = {} result = {}
for key, value in event.items(): for key, value in _event.items():
if hasattr(value, 'to_dict'): if hasattr(value, 'to_dict'):
result[key] = value.to_dict() result[key] = value.to_dict()
else: else: