This commit is contained in:
caiwx86 2024-07-22 04:14:54 +08:00
parent 6df136175a
commit fab43ae4de

View File

@ -569,11 +569,13 @@ class CBZUtils:
cbz_info = cls.zip_info(zip_path) cbz_info = cls.zip_info(zip_path)
if len(cbz_info) == len(comic_info_images): if len(cbz_info) == len(comic_info_images):
# logging.info(f"validating successfully === {zip_path}") # 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 return True
else: else:
os.remove(zip_path) 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 return False
# 检测工具类 # 检测工具类
@ -741,6 +743,36 @@ class ntfy:
else: else:
return True 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: class logger:
def log_image_download(self, image_path): def log_image_download(self, image_path):
if image_path == "": if image_path == "":