diff --git a/Comics/utils.py b/Comics/utils.py index 8d761e7..4cef493 100644 --- a/Comics/utils.py +++ b/Comics/utils.py @@ -569,11 +569,13 @@ class CBZUtils: cbz_info = cls.zip_info(zip_path) if len(cbz_info) == len(comic_info_images): # logging.info(f"validating successfully === {zip_path}") - ntfy.sendMsg(f"validating successfully === {zip_path}", alert=True) + # ntfy.sendMsg(f"validating successfully === {zip_path}", alert=True) + ntfy.gotify(title="漫画下载完成", message=f"validating successfully === {zip_path}") return True else: os.remove(zip_path) - ntfy.sendMsg(f"validating fail === {zip_path}, cbz_info={cbz_info},zip_info={comic_info_images}", alert=True) + ntfy.gotify(title="漫画校验失败", message=f"validating fail === {zip_path}, cbz_info={cbz_info},zip_info={comic_info_images}") + #ntfy.sendMsg(f"validating fail === {zip_path}, cbz_info={cbz_info},zip_info={comic_info_images}", alert=True) return False # 检测工具类 @@ -741,6 +743,36 @@ class ntfy: else: return True + @classmethod + def gotify(cls,title, message): + # 替换为您的 Gotify 服务器 URL + GOTIFY_URL = 'https://gotify.caiwenxiu.cn' + # 替换为您的 Gotify 应用程序令牌 + GOTIFY_TOKEN = 'Aq3balsIgPjwD6D' + # 通知的标题和消息 + #title = "Test Notification" + #message = "This is a test message from Python script." + # 要发送的通知数据 + payload = { + 'title': title, + 'message': message, + 'priority': 5 + } + # 发送 POST 请求到 Gotify 服务器 + response = requests.post( + f'{GOTIFY_URL}/message', + headers={'X-Gotify-Key': GOTIFY_TOKEN}, + json=payload + ) + + # 检查响应状态码 + if response.status_code == 200: + print("Notification sent successfully!") + else: + print(f"Failed to send notification. Status code: {response.status_code}") + print(response.json()) + + class logger: def log_image_download(self, image_path): if image_path == "":