Skip to content

Commit

Permalink
2024-03-06, fix bug for kktix_status, auto fill text for cityline.
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Mar 18, 2024
1 parent c703cdc commit dc78806
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 10 deletions.
42 changes: 39 additions & 3 deletions chrome_tixcraft.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
except Exception as exc:
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_CONFIG_FILE = "settings.json"
Expand Down Expand Up @@ -8482,6 +8482,36 @@ def cityline_clean_ads(driver):
except Exception as exc:
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):
# https://msg.cityline.com/ https://event.cityline.com/
if 'msg.cityline.com' in url or 'event.cityline.com' in url:
Expand Down Expand Up @@ -8510,10 +8540,9 @@ def cityline_main(driver, url, config_dict):
# show HTTP ERROR 400
pass


# https://www.cityline.com/Login.html?targetUrl=https%3A%2F%2F
# ignore url redirect
if '/Login.html' in url:
if '.com/Login.html' in url:
cityline_account = config_dict["advanced"]["cityline_account"]
cityline_password = config_dict["advanced"]["cityline_password_plaintext"].strip()
if cityline_password == "":
Expand Down Expand Up @@ -8549,6 +8578,13 @@ def cityline_main(driver, url, config_dict):
if len(url.split('/'))>=5:
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):
question_div = None
try:
Expand Down
2 changes: 1 addition & 1 deletion config_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import threading
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_CONFIG_FILE = "settings.json"
Expand Down
16 changes: 11 additions & 5 deletions kktix_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

import requests

CONST_APP_VERSION = "MaxBot (2024.03.05)"
CONST_APP_VERSION = "MaxBot (2024.03.06)"

CONST_MAXBOT_CONFIG_FILE = "settings.json"
CONST_MAXBOT_KKTIX_CONFIG_FILE = "kktix.json"
Expand Down Expand Up @@ -945,14 +945,20 @@ def kktix_status_query(config_dict, last_status, log_file=False):
if registerStatus=="IN_STOCK":
btn_index = 1
try:
print(config_dict["ticket_exec_maxbot"])
if config_dict["ticket_exec_maxbot"]:
filename=config_dict["list"][btn_index-1].get().strip()
threading.Thread(target=launch_maxbot, args=(filename,)).start()
filename=config_dict["list"][btn_index-1]
print("filename", filename)
if len(filename) > 0:
threading.Thread(target=launch_maxbot, args=(filename,)).start()

print(config_dict["ticket_exec_command"], config_dict["new_process"])
if config_dict["ticket_exec_command"]:
working_dir = os.path.dirname(os.path.realpath(__file__))
subprocess.Popen(config_dict["new_process"] , shell=True, cwd=working_dir)
if len(config_dict["new_process"]) > 0:
working_dir = os.path.dirname(os.path.realpath(__file__))
subprocess.Popen(config_dict["new_process"] , shell=True, cwd=working_dir)
except Exception as e:
print(e)
pass

return registerStatus
Expand Down
2 changes: 1 addition & 1 deletion settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
except Exception as exc:
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_CONFIG_FILE = "settings.json"
Expand Down

0 comments on commit dc78806

Please sign in to comment.