reduce a thread, show running on PORT debug message.
parent
600433be1f
commit
66d62cef21
|
@ -41,7 +41,7 @@ try:
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
CONST_APP_VERSION = "MaxBot (2024.01.08)"
|
CONST_APP_VERSION = "MaxBot (2024.01.09)"
|
||||||
|
|
||||||
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
|
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
|
||||||
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
||||||
|
@ -578,7 +578,7 @@ def dump_settins_to_maxbot_plus_extension(ext, config_dict):
|
||||||
if os.path.isfile(target_path):
|
if os.path.isfile(target_path):
|
||||||
with open(target_path) as json_data:
|
with open(target_path) as json_data:
|
||||||
manifest_dict = json.load(json_data)
|
manifest_dict = json.load(json_data)
|
||||||
|
|
||||||
local_remote_url_array = []
|
local_remote_url_array = []
|
||||||
local_remote_url = config_dict["advanced"]["remote_url"]
|
local_remote_url = config_dict["advanced"]["remote_url"]
|
||||||
if len(local_remote_url) > 0:
|
if len(local_remote_url) > 0:
|
||||||
|
@ -589,7 +589,7 @@ def dump_settins_to_maxbot_plus_extension(ext, config_dict):
|
||||||
local_remote_url_array.append(remote_url_final)
|
local_remote_url_array.append(remote_url_final)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if len(local_remote_url_array) > 0:
|
if len(local_remote_url_array) > 0:
|
||||||
is_manifest_changed = False
|
is_manifest_changed = False
|
||||||
for remote_url_final in local_remote_url_array:
|
for remote_url_final in local_remote_url_array:
|
||||||
|
@ -618,12 +618,10 @@ def dump_settins_to_maxbot_plus_extension(ext, config_dict):
|
||||||
line = line.replace('display: none;','')
|
line = line.replace('display: none;','')
|
||||||
new_html_array.append(line)
|
new_html_array.append(line)
|
||||||
if len(new_html_array) > 0:
|
if len(new_html_array) > 0:
|
||||||
print("output new options.html")
|
#print("output new options.html")
|
||||||
with open(target_path, 'w') as outfile:
|
with open(target_path, 'w') as outfile:
|
||||||
outfile.write("".join(new_html_array))
|
outfile.write("".join(new_html_array))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_uc_options(uc, config_dict, webdriver_path):
|
def get_uc_options(uc, config_dict, webdriver_path):
|
||||||
options = uc.ChromeOptions()
|
options = uc.ChromeOptions()
|
||||||
|
@ -3434,7 +3432,7 @@ def tixcraft_assign_ticket_number(driver, config_dict):
|
||||||
if row_text.isnumeric():
|
if row_text.isnumeric():
|
||||||
# ticket assign.
|
# ticket assign.
|
||||||
is_ticket_number_assigned = True
|
is_ticket_number_assigned = True
|
||||||
|
|
||||||
return is_ticket_number_assigned, select_obj
|
return is_ticket_number_assigned, select_obj
|
||||||
|
|
||||||
|
|
||||||
|
@ -4666,7 +4664,7 @@ def kktix_reg_new_main(driver, config_dict, fail_list, captcha_sound_played, is_
|
||||||
|
|
||||||
def kktix_get_registerStatus(driver, event_code):
|
def kktix_get_registerStatus(driver, event_code):
|
||||||
html_result = None
|
html_result = None
|
||||||
|
|
||||||
url = "https://kktix.com/g/events/%s/register_info" % (event_code)
|
url = "https://kktix.com/g/events/%s/register_info" % (event_code)
|
||||||
#print('event_code:',event_code)
|
#print('event_code:',event_code)
|
||||||
#print("url:", url)
|
#print("url:", url)
|
||||||
|
@ -11913,7 +11911,7 @@ def ticketplus_keyin_captcha_code(driver, answer = "", auto_submit = False):
|
||||||
is_verifyCode_editing = True
|
is_verifyCode_editing = True
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# plan B.
|
# plan B.
|
||||||
try:
|
try:
|
||||||
#print("use plan b to focus()")
|
#print("use plan b to focus()")
|
||||||
|
@ -11955,11 +11953,11 @@ def ticketplus_keyin_captcha_code(driver, answer = "", auto_submit = False):
|
||||||
# for style_1
|
# for style_1
|
||||||
my_css_selector = "div.order-footer > div.container > div.row > div > div.row > div > button.nextBtn"
|
my_css_selector = "div.order-footer > div.container > div.row > div > div.row > div > button.nextBtn"
|
||||||
is_form_sumbited = force_press_button(driver, By.CSS_SELECTOR, my_css_selector)
|
is_form_sumbited = force_press_button(driver, By.CSS_SELECTOR, my_css_selector)
|
||||||
|
|
||||||
if is_form_sumbited:
|
if is_form_sumbited:
|
||||||
# must delay 0.5 second wait ajax return.
|
# must delay 0.5 second wait ajax return.
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
||||||
is_verifyCode_editing = False
|
is_verifyCode_editing = False
|
||||||
|
|
||||||
return is_verifyCode_editing, is_form_sumbited
|
return is_verifyCode_editing, is_form_sumbited
|
||||||
|
@ -12181,7 +12179,7 @@ def ticketplus_main(driver, url, config_dict, ocr, Captcha_Browser, ticketplus_d
|
||||||
# move below code to chrome extension.
|
# move below code to chrome extension.
|
||||||
if not config_dict["browser"] in CONST_CHROME_FAMILY:
|
if not config_dict["browser"] in CONST_CHROME_FAMILY:
|
||||||
is_reloading = ticketplus_order_auto_reload_coming_soon(driver)
|
is_reloading = ticketplus_order_auto_reload_coming_soon(driver)
|
||||||
|
|
||||||
if not is_reloading:
|
if not is_reloading:
|
||||||
is_captcha_sent, ticketplus_dict = ticketplus_order(driver, config_dict, ocr, Captcha_Browser, ticketplus_dict)
|
is_captcha_sent, ticketplus_dict = ticketplus_order(driver, config_dict, ocr, Captcha_Browser, ticketplus_dict)
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import sys
|
||||||
import threading
|
import threading
|
||||||
import webbrowser
|
import webbrowser
|
||||||
|
|
||||||
CONST_APP_VERSION = "MaxBot (2024.01.08)"
|
CONST_APP_VERSION = "MaxBot (2024.01.09)"
|
||||||
|
|
||||||
CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json"
|
CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json"
|
||||||
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
||||||
|
|
21
settings.py
21
settings.py
|
@ -38,7 +38,7 @@ try:
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
CONST_APP_VERSION = "MaxBot (2024.01.08)"
|
CONST_APP_VERSION = "MaxBot (2024.01.09)"
|
||||||
|
|
||||||
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
|
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
|
||||||
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
||||||
|
@ -100,6 +100,8 @@ URL_CHROME_DRIVER = 'https://chromedriver.chromium.org/'
|
||||||
URL_FIREFOX_DRIVER = 'https://github.com/mozilla/geckodriver/releases'
|
URL_FIREFOX_DRIVER = 'https://github.com/mozilla/geckodriver/releases'
|
||||||
URL_EDGE_DRIVER = 'https://developer.microsoft.com/zh-tw/microsoft-edge/tools/webdriver/'
|
URL_EDGE_DRIVER = 'https://developer.microsoft.com/zh-tw/microsoft-edge/tools/webdriver/'
|
||||||
|
|
||||||
|
GLOBAL_SERVER_SHUTDOWN = False
|
||||||
|
|
||||||
def load_translate():
|
def load_translate():
|
||||||
translate = {}
|
translate = {}
|
||||||
en_us={}
|
en_us={}
|
||||||
|
@ -2422,12 +2424,10 @@ def resetful_api_timer():
|
||||||
while True:
|
while True:
|
||||||
btn_preview_text_clicked()
|
btn_preview_text_clicked()
|
||||||
preview_question_text_file()
|
preview_question_text_file()
|
||||||
time.sleep(0.2)
|
|
||||||
|
|
||||||
def settings_timer():
|
|
||||||
while True:
|
|
||||||
update_maxbot_runtime_status()
|
update_maxbot_runtime_status()
|
||||||
time.sleep(0.6)
|
time.sleep(0.3)
|
||||||
|
if GLOBAL_SERVER_SHUTDOWN:
|
||||||
|
break
|
||||||
|
|
||||||
def clean_extension_status():
|
def clean_extension_status():
|
||||||
Root_Dir = get_app_root()
|
Root_Dir = get_app_root()
|
||||||
|
@ -2765,9 +2765,9 @@ def main():
|
||||||
root.call('wm', 'iconphoto', root._w, logo)
|
root.call('wm', 'iconphoto', root._w, logo)
|
||||||
os.remove(icon_filepath)
|
os.remove(icon_filepath)
|
||||||
|
|
||||||
threading.Thread(target=settings_timer, daemon=True).start()
|
|
||||||
root.mainloop()
|
root.mainloop()
|
||||||
print("exit settings")
|
print("exit settings")
|
||||||
|
GLOBAL_SERVER_SHUTDOWN=True
|
||||||
clean_extension_status()
|
clean_extension_status()
|
||||||
|
|
||||||
def force_remove_file(filepath):
|
def force_remove_file(filepath):
|
||||||
|
@ -2854,12 +2854,12 @@ class VersionHandler(tornado.web.RequestHandler):
|
||||||
class OcrHandler(tornado.web.RequestHandler):
|
class OcrHandler(tornado.web.RequestHandler):
|
||||||
def get(self):
|
def get(self):
|
||||||
self.write({"answer": "1234"})
|
self.write({"answer": "1234"})
|
||||||
|
|
||||||
def post(self):
|
def post(self):
|
||||||
self.set_header("Access-Control-Allow-Origin", "*")
|
self.set_header("Access-Control-Allow-Origin", "*")
|
||||||
self.set_header("Access-Control-Allow-Headers", "x-requested-with")
|
self.set_header("Access-Control-Allow-Headers", "x-requested-with")
|
||||||
self.set_header('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')
|
self.set_header('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')
|
||||||
|
|
||||||
_body = None
|
_body = None
|
||||||
is_pass_check = True
|
is_pass_check = True
|
||||||
errorMessage = ""
|
errorMessage = ""
|
||||||
|
@ -2918,6 +2918,7 @@ async def main_server():
|
||||||
app.version = CONST_APP_VERSION;
|
app.version = CONST_APP_VERSION;
|
||||||
|
|
||||||
app.listen(CONST_SERVER_PORT)
|
app.listen(CONST_SERVER_PORT)
|
||||||
|
print("server running on port:", CONST_SERVER_PORT)
|
||||||
await asyncio.Event().wait()
|
await asyncio.Event().wait()
|
||||||
|
|
||||||
def web_server():
|
def web_server():
|
||||||
|
|
Loading…
Reference in New Issue