2024-03-06, fix bug for kktix_status, auto fill text for cityline.

master
Your Name 2024-03-18 12:51:30 +08:00
parent c703cdca12
commit dc788069e7
4 changed files with 52 additions and 10 deletions

View File

@ -42,7 +42,7 @@ try:
except Exception as exc: except Exception as exc:
pass pass
CONST_APP_VERSION = "MaxBot (2024.03.05)" CONST_APP_VERSION = "MaxBot (2024.03.06)"
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"
@ -8482,6 +8482,36 @@ def cityline_clean_ads(driver):
except Exception as exc: except Exception as exc:
pass pass
def cityline_input_code(driver, config_dict, fail_list):
show_debug_message = True # debug.
show_debug_message = False # online
if config_dict["advanced"]["verbose"]:
show_debug_message = True
answer_list = []
answer_list = get_answer_list_from_user_guess_string(config_dict)
inferred_answer_string = ""
for answer_item in answer_list:
if not answer_item in fail_list:
inferred_answer_string = answer_item
break
if show_debug_message:
print("inferred_answer_string:", inferred_answer_string)
print("answer_list:", answer_list)
# PS: auto-focus() when empty inferred_answer_string with empty inputed text value.
input_text_css = "input[type='text']"
next_step_button_css = ""
submit_by_enter = False
check_input_interval = 0.2
is_answer_sent, fail_list = fill_common_verify_form(driver, config_dict, inferred_answer_string, fail_list, input_text_css, next_step_button_css, submit_by_enter, check_input_interval)
return fail_list
def cityline_main(driver, url, config_dict): def cityline_main(driver, url, config_dict):
# https://msg.cityline.com/ https://event.cityline.com/ # https://msg.cityline.com/ https://event.cityline.com/
if 'msg.cityline.com' in url or 'event.cityline.com' in url: if 'msg.cityline.com' in url or 'event.cityline.com' in url:
@ -8510,10 +8540,9 @@ def cityline_main(driver, url, config_dict):
# show HTTP ERROR 400 # show HTTP ERROR 400
pass pass
# https://www.cityline.com/Login.html?targetUrl=https%3A%2F%2F # https://www.cityline.com/Login.html?targetUrl=https%3A%2F%2F
# ignore url redirect # ignore url redirect
if '/Login.html' in url: if '.com/Login.html' in url:
cityline_account = config_dict["advanced"]["cityline_account"] cityline_account = config_dict["advanced"]["cityline_account"]
cityline_password = config_dict["advanced"]["cityline_password_plaintext"].strip() cityline_password = config_dict["advanced"]["cityline_password_plaintext"].strip()
if cityline_password == "": if cityline_password == "":
@ -8549,6 +8578,13 @@ def cityline_main(driver, url, config_dict):
if len(url.split('/'))>=5: if len(url.split('/'))>=5:
cityline_shows_goto_cta(driver) cityline_shows_goto_cta(driver)
# https://venue.cityline.com/utsvInternet/XXX/login?lang=TW
if '/utsvInternet/' in url and '/login?' in url:
if len(url.split('/')) == 6:
fail_list = []
fail_list = cityline_input_code(driver, config_dict, fail_list)
def get_ibon_question_text(driver): def get_ibon_question_text(driver):
question_div = None question_div = None
try: try:

View File

@ -23,7 +23,7 @@ import sys
import threading import threading
import webbrowser import webbrowser
CONST_APP_VERSION = "MaxBot (2024.03.05)" CONST_APP_VERSION = "MaxBot (2024.03.06)"
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"

View File

@ -29,7 +29,7 @@ from datetime import datetime
import requests import requests
CONST_APP_VERSION = "MaxBot (2024.03.05)" CONST_APP_VERSION = "MaxBot (2024.03.06)"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"
CONST_MAXBOT_KKTIX_CONFIG_FILE = "kktix.json" CONST_MAXBOT_KKTIX_CONFIG_FILE = "kktix.json"
@ -945,14 +945,20 @@ def kktix_status_query(config_dict, last_status, log_file=False):
if registerStatus=="IN_STOCK": if registerStatus=="IN_STOCK":
btn_index = 1 btn_index = 1
try: try:
print(config_dict["ticket_exec_maxbot"])
if config_dict["ticket_exec_maxbot"]: if config_dict["ticket_exec_maxbot"]:
filename=config_dict["list"][btn_index-1].get().strip() filename=config_dict["list"][btn_index-1]
print("filename", filename)
if len(filename) > 0:
threading.Thread(target=launch_maxbot, args=(filename,)).start() threading.Thread(target=launch_maxbot, args=(filename,)).start()
print(config_dict["ticket_exec_command"], config_dict["new_process"])
if config_dict["ticket_exec_command"]: if config_dict["ticket_exec_command"]:
if len(config_dict["new_process"]) > 0:
working_dir = os.path.dirname(os.path.realpath(__file__)) working_dir = os.path.dirname(os.path.realpath(__file__))
subprocess.Popen(config_dict["new_process"] , shell=True, cwd=working_dir) subprocess.Popen(config_dict["new_process"] , shell=True, cwd=working_dir)
except Exception as e: except Exception as e:
print(e)
pass pass
return registerStatus return registerStatus

View File

@ -50,7 +50,7 @@ try:
except Exception as exc: except Exception as exc:
pass pass
CONST_APP_VERSION = "MaxBot (2024.03.05)" CONST_APP_VERSION = "MaxBot (2024.03.06)"
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"