can retry the contacts in error

This commit is contained in:
Lei PAN
2022-06-16 12:57:10 +02:00
parent 636ef124d5
commit fe0e144a1a
5 changed files with 86 additions and 52 deletions
+31 -21
View File
@@ -1,7 +1,7 @@
import PySimpleGUI as sg
# First the window layout in 2 columns
from main import start_book
from main import start_book, recheck_the_captcha_error_contacts
from pojo.ModeEnum import ModeEnum
from proxy.proxy_type import ProxyType
@@ -20,13 +20,15 @@ KEY_MANUAL = "KEY_MANUAL"
GROUP_MODE = "GROUP_MODE"
GROUP_STORE = "STORE"
GROUP_PROXY = "GROUP_PROXY"
KEY_RUN_ERROR_CONTACT = "KEY_RUN_ERROR_CONTACT"
file_list_column = [
[sg.Text('请输入联系人表的起始和结束行')],
[sg.Text('起始行', size=(15, 1)), sg.InputText(tooltip="起始行", key=KEY_START_NUMBER)],
[sg.Text('结束行', size=(15, 1)), sg.InputText(tooltip="结束行", key=KEY_END_NUMBER)],
[sg.Text('并发数', size=(15, 1)), sg.InputText(tooltip="结束行", key=KEY_MAX_WORKERS, default_text=10)],
[sg.Submit(button_text="运行", key="submit")]
[sg.Submit(button_text="运行", key="submit")],
[sg.Submit(button_text="重约发生错误的约会", key=KEY_RUN_ERROR_CONTACT)]
]
# For now will only show the name of the file that was chosen
store_settings_column = [
@@ -59,34 +61,42 @@ layout = [
window = sg.Window("爱马仕约会", layout)
def on_no_contact_found():
sg.popup("对应联系人列表为空")
while True:
event, values = window.read()
print(event)
print(values)
# try:
max_workers = int(values[KEY_MAX_WORKERS])
store_type = 0
mode = ModeEnum.MANUAL
if values[KEY_FAUBOURG]:
store_type = 1
elif values[KEY_GEORGE]:
store_type = 2
elif values[KEY_SEVRES]:
store_type = 3
proxy_type = ProxyType.BRIGHT_DATA
if values[KEY_PROXY_NETNUT]:
proxy_type = ProxyType.NETNUT
elif values[KEY_PROXY_BRIGHTDATA]:
proxy_type = ProxyType.BRIGHT_DATA
if values[KEY_AUTOMATIC]:
mode = ModeEnum.AUTOMATIC
if event == "submit":
# try:
start_line = int(values[KEY_START_NUMBER])
end_line = int(values[KEY_END_NUMBER])
max_workers = int(values[KEY_MAX_WORKERS])
store_type = 0
mode = ModeEnum.MANUAL
if values[KEY_FAUBOURG]:
store_type = 1
elif values[KEY_GEORGE]:
store_type = 2
elif values[KEY_SEVRES]:
store_type = 3
proxy_type = ProxyType.BRIGHT_DATA
if values[KEY_PROXY_NETNUT]:
proxy_type = ProxyType.NETNUT
elif values[KEY_PROXY_BRIGHTDATA]:
proxy_type = ProxyType.BRIGHT_DATA
if values[KEY_AUTOMATIC]:
mode = ModeEnum.AUTOMATIC
start_book(start_line, end_line, store_choose_state=store_type, max_workers=max_workers, proxy_type=proxy_type,
mode=mode)
elif event == KEY_RUN_ERROR_CONTACT:
recheck_the_captcha_error_contacts(max_workers=max_workers, store_type=store_type, mode=mode,
on_no_contact_found=on_no_contact_found)
elif event == "Exit" or event == sg.WIN_CLOSED:
break