minor fix

This commit is contained in:
2025-08-14 13:38:13 +08:00
parent 64497729ad
commit 0d8648c567

View File

@@ -183,6 +183,16 @@ def main():
time.sleep(args.interval) time.sleep(args.interval)
while True: while True:
try:
# 打开草稿箱
click("li[data-id='default0/Brouillons']", condition=EC.presence_of_element_located)
click("button[data-id='default0/Brouillons']", condition=EC.presence_of_element_located)
# 打开邮件
click("ul[aria-label='List view'] li[data-index='0']", condition=EC.presence_of_element_located)
except Exception as e:
print(f'[警告] 打开草稿邮件时发生了错误:{e}')
pass
try: try:
print('[信息] 请选择数据源') print('[信息] 请选择数据源')
title = 'Open (%s)' % args.address title = 'Open (%s)' % args.address
@@ -215,17 +225,6 @@ def main():
print(f'[信息] 已读取联系人信息共 {limit}') print(f'[信息] 已读取联系人信息共 {limit}')
if limit == 0: continue if limit == 0: continue
try:
# 打开草稿箱
click("li[data-id='default0/Brouillons']", condition=EC.presence_of_element_located)
click("button[data-id='default0/Brouillons']", condition=EC.presence_of_element_located)
# 打开邮件
click("ul[aria-label='List view'] li[data-index='0']", condition=EC.presence_of_element_located)
except Exception as e:
print(f'[警告] 打开草稿邮件时发生了错误:{e}')
print(f'[信息] 提示:请手动选择邮件')
pass
rate = 60 / (args.interval + 3) rate = 60 / (args.interval + 3)
length = list.count(sents, None) length = list.count(sents, None)
timezone = ZoneInfo(args.timezone) if args.timezone else None timezone = ZoneInfo(args.timezone) if args.timezone else None
@@ -237,9 +236,9 @@ def main():
entries = list(filter(lambda it: it.get('locale') == suffix, greetings)) entries = list(filter(lambda it: it.get('locale') == suffix, greetings))
locale = dict(entries[0]) if len(entries) > 0 else None locale = dict(entries[0]) if len(entries) > 0 else None
print(f'[信息] 当前语言:{str(suffix).upper() if locale else ''}', end='\n\n') print(f'[信息] 当前语言:{str(suffix).upper() if locale else ''}')
if input('[????] 确认操作:(y) 确定 / (N) 取消') not in ['Y', 'y']: if input('[????] 是否继续?确定 (y) / 取消 (N): ') not in ['Y', 'y']:
print('[信息] 操作取消') print('[信息] 操作取消')
continue continue
@@ -248,7 +247,7 @@ def main():
print(f'[信息] 已读取邮件:{subject}') print(f'[信息] 已读取邮件:{subject}')
print(f'[信息] 指定发件人:{sender}') print(f'[信息] 指定发件人:{sender}')
if sender.lower().find(f'<{str(args.address).lower()}>'): if sender.lower().find(f'<{str(args.address).lower()}>') == -1:
print(f'[警告] 检测到发件人与设定不一致') print(f'[警告] 检测到发件人与设定不一致')
print(f'[信息] 提示:请检查邮件是否正确') print(f'[信息] 提示:请检查邮件是否正确')
@@ -294,7 +293,7 @@ def main():
if (target := locate("h1.subject").text.strip()) != subject: if (target := locate("h1.subject").text.strip()) != subject:
print(f'[警告] 邮件主题与设定不一致:{target}') print(f'[警告] 邮件主题与设定不一致:{target}')
if input('[????] 是否继续(y) / (N): ') in ['Y', 'y']: if input('[????] 是否继续?确定 (y) / 取消 (N): ') in ['Y', 'y']:
subject = target subject = target
print(f'[信息] 已更新邮件主题设定') print(f'[信息] 已更新邮件主题设定')
else: else:
@@ -397,8 +396,8 @@ def main():
except Exception as e: except Exception as e:
print(f'[警告] 写入文件时发生了错误:{e}') print(f'[警告] 写入文件时发生了错误:{e}')
if input('[????] 继续运行 (C) / 退出程序 (w): ') in ['W', 'w']: break if active and input('[????] 继续运行 (c) / 退出程序 (W): ') in ['C', 'c']: continue
else: continue else: break
return 0 return 0