mirror of
https://github.com/hlt1995/qlScripts.git
synced 2026-11-05 23:26:44 +08:00
Update notify.py
This commit is contained in:
1 parent
f0aebd6c98
commit
e4ae5abe77
1 file changed
-6
@@ -116,27 +116,22 @@ def bark(title: str, content: str) -> None:
|
||||
return
|
||||
print("bark 服务启动")
|
||||
|
||||
# 分段推送逻辑:每10个账号为一段
|
||||
lines = content.split('\n')
|
||||
segments = []
|
||||
current_segment = []
|
||||
account_count = 0
|
||||
|
||||
for line in lines:
|
||||
# 判断是否为账号行(这里可以根据实际内容调整判断逻辑)
|
||||
if any(keyword in line for keyword in ['账号', '用户', 'user', 'account']):
|
||||
account_count += 1
|
||||
# 每10个账号开始新的一段
|
||||
if account_count > 1 and account_count % 6 == 1:
|
||||
segments.append('\n'.join(current_segment))
|
||||
current_segment = []
|
||||
current_segment.append(line)
|
||||
|
||||
# 添加最后一段
|
||||
if current_segment:
|
||||
segments.append('\n'.join(current_segment))
|
||||
|
||||
# 如果不需要分段(账号数少于等于10),则按原逻辑推送
|
||||
if len(segments) <= 1:
|
||||
_send_bark_segment(title, content)
|
||||
else:
|
||||
@@ -145,7 +140,6 @@ def bark(title: str, content: str) -> None:
|
||||
for i, segment in enumerate(segments, 1):
|
||||
segment_title = f"{title} ({i}/{total_segments})"
|
||||
_send_bark_segment(segment_title, segment)
|
||||
# 添加短暂延迟,避免推送过于频繁
|
||||
if i < total_segments:
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
Reference in new issue
Block a user