2023-03-20, bugs fix for kham, add area_keyword_exclude field.

master
CHUN YU YAO 2023-03-22 01:33:12 +08:00
parent 3a997cf9c5
commit 7e6b7fb7c4
4 changed files with 319 additions and 279 deletions

View File

@ -53,7 +53,7 @@ import argparse
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
CONST_APP_VERSION = u"MaxBot (2023.03.14)"
CONST_APP_VERSION = u"MaxBot (2023.03.20)"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
@ -415,82 +415,10 @@ def close_browser_tabs(driver):
def get_driver_by_config(config_dict):
global driver
homepage = None
browser = None
language = "English"
ticket_number = "2"
auto_press_next_step_button = False # default not checked.
auto_fill_ticket_number = False # default not checked.
auto_guess_options = False # default not checked.
kktix_area_auto_select_mode = ""
kktix_area_keyword = ""
kktix_date_keyword = ""
pass_1_seat_remaining_enable = False # default not checked.
pass_date_is_sold_out_enable = False # default not checked.
auto_reload_coming_soon_page_enable = True # default checked.
area_keyword_1 = ""
area_keyword_2 = ""
area_keyword_3 = ""
area_keyword_4 = ""
date_keyword = ""
date_auto_select_enable = None
date_auto_select_mode = ""
area_auto_select_enable = None
area_auto_select_mode = ""
# read config.
homepage = config_dict["homepage"]
browser = config_dict["browser"]
# output debug message in client side.
ticket_number = str(config_dict["ticket_number"])
pass_1_seat_remaining_enable = config_dict["pass_1_seat_remaining"]
# for ["kktix"]
auto_press_next_step_button = config_dict["kktix"]["auto_press_next_step_button"]
auto_fill_ticket_number = config_dict["kktix"]["auto_fill_ticket_number"]
kktix_area_auto_select_mode = config_dict["kktix"]["area_mode"].strip()
if not kktix_area_auto_select_mode in CONST_SELECT_OPTIONS_ARRAY:
kktix_area_auto_select_mode = CONST_SELECT_ORDER_DEFAULT
kktix_area_keyword_1 = config_dict["kktix"]["area_keyword_1"].strip()
kktix_area_keyword_1_and = config_dict["kktix"]["area_keyword_1_and"].strip()
kktix_area_keyword_2 = config_dict["kktix"]["area_keyword_2"].strip()
kktix_area_keyword_2_and = config_dict["kktix"]["area_keyword_2_and"].strip()
# disable password brute force attack
# PS: because of the question is always variable.
auto_guess_options = config_dict["kktix"]["auto_guess_options"]
# for ["tixcraft"]
date_auto_select_enable = config_dict["tixcraft"]["date_auto_select"]["enable"]
date_auto_select_mode = config_dict["tixcraft"]["date_auto_select"]["mode"]
if not date_auto_select_mode in CONST_SELECT_OPTIONS_ARRAY:
date_auto_select_mode = CONST_SELECT_ORDER_DEFAULT
date_keyword = config_dict["tixcraft"]["date_auto_select"]["date_keyword"].strip()
area_auto_select_enable = config_dict["tixcraft"]["area_auto_select"]["enable"]
area_auto_select_mode = config_dict["tixcraft"]["area_auto_select"]["mode"]
if not area_auto_select_mode in CONST_SELECT_OPTIONS_ARRAY:
area_auto_select_mode = CONST_SELECT_ORDER_DEFAULT
area_keyword_1 = config_dict["tixcraft"]["area_auto_select"]["area_keyword_1"].strip()
area_keyword_2 = config_dict["tixcraft"]["area_auto_select"]["area_keyword_2"].strip()
area_keyword_3 = config_dict["tixcraft"]["area_auto_select"]["area_keyword_3"].strip()
area_keyword_4 = config_dict["tixcraft"]["area_auto_select"]["area_keyword_4"].strip()
pass_date_is_sold_out_enable = config_dict["tixcraft"]["pass_date_is_sold_out"]
auto_reload_coming_soon_page_enable = config_dict["tixcraft"]["auto_reload_coming_soon_page"]
driver_type = config_dict["webdriver_type"]
# output config:
@ -499,8 +427,8 @@ def get_driver_by_config(config_dict):
print("platform", platform.platform())
print("homepage", homepage)
print("browser", browser)
print("ticket_number", ticket_number)
print("pass_1_seat_remaining", pass_1_seat_remaining_enable)
print("ticket_number", str(config_dict["ticket_number"]))
print("pass_1_seat_remaining", config_dict["pass_1_seat_remaining"])
print("==[kktix]==")
print(config_dict["kktix"])
@ -521,7 +449,6 @@ def get_driver_by_config(config_dict):
print("platform.system().lower():", platform.system().lower())
adblock_plus_enable = config_dict["advanced"]["adblock_plus_enable"]
print("adblock_plus_enable:", adblock_plus_enable)
headless = config_dict["advanced"]["headless"]
if browser == "chrome":
@ -557,7 +484,7 @@ def get_driver_by_config(config_dict):
options.add_argument('--headless')
#options.add_argument('--headless=new')
if platform.system().lower()=="windows":
options.binary_location = r'C:\Program Files\Mozilla Firefox\firefox.exe'
options.binary_location = r'C:\\Program Files\\Mozilla Firefox\\firefox.exe'
driver = webdriver.Firefox(service=webdriver_service, options=options)
except Exception as exc:
@ -1539,7 +1466,7 @@ def tixcraft_date_auto_select(driver, url, config_dict, domain_name):
# is_need_refresh
# matched_blocks
# PS: matched_blocks will be None, if length equals zero.
def get_tixcraft_target_area(el, area_keyword, area_auto_select_mode, pass_1_seat_remaining_enable):
def get_tixcraft_target_area(el, area_keyword, area_auto_select_mode, pass_1_seat_remaining_enable, area_keyword_exclude):
show_debug_message = True # debug.
show_debug_message = False # online
@ -1584,6 +1511,11 @@ def get_tixcraft_target_area(el, area_keyword, area_auto_select_mode, pass_1_sea
if row_text is None:
row_text = ""
if len(row_text):
if len(area_keyword_exclude) > 0:
if area_keyword_exclude in row_text:
row_text = ""
if len(row_text) > 0:
# clean stop word.
row_text = format_keyword_string(row_text)
@ -1667,6 +1599,7 @@ def tixcraft_area_auto_select(driver, url, config_dict):
area_keyword_3 = config_dict["tixcraft"]["area_auto_select"]["area_keyword_3"].strip()
area_keyword_4 = config_dict["tixcraft"]["area_auto_select"]["area_keyword_4"].strip()
area_auto_select_mode = config_dict["tixcraft"]["area_auto_select"]["mode"]
area_keyword_exclude = config_dict["tixcraft"]["area_auto_select"]["area_keyword_exclude"]
area_keyword_2_enable = config_dict["tixcraft"]["area_auto_select"]["area_keyword_2_enable"]
area_keyword_3_enable = config_dict["tixcraft"]["area_auto_select"]["area_keyword_3_enable"]
@ -1692,7 +1625,7 @@ def tixcraft_area_auto_select(driver, url, config_dict):
print("find .zone fail, do nothing.")
if el is not None:
is_need_refresh, areas = get_tixcraft_target_area(el, area_keyword_1, area_auto_select_mode, pass_1_seat_remaining_enable)
is_need_refresh, areas = get_tixcraft_target_area(el, area_keyword_1, area_auto_select_mode, pass_1_seat_remaining_enable, area_keyword_exclude)
if show_debug_message:
print("is_need_refresh for keyword1:", is_need_refresh)
@ -1704,7 +1637,7 @@ def tixcraft_area_auto_select(driver, url, config_dict):
# only when keyword#2 filled to query.
if area_keyword_2_enable:
if area_keyword_1 != area_keyword_2:
is_need_refresh, areas = get_tixcraft_target_area(el, area_keyword_2, area_auto_select_mode, pass_1_seat_remaining_enable)
is_need_refresh, areas = get_tixcraft_target_area(el, area_keyword_2, area_auto_select_mode, pass_1_seat_remaining_enable, area_keyword_exclude)
if show_debug_message:
print("is_need_refresh for keyword2:", is_need_refresh)
@ -1716,7 +1649,7 @@ def tixcraft_area_auto_select(driver, url, config_dict):
# only when keyword#3 filled to query.
if area_keyword_3_enable:
if area_keyword_1 != area_keyword_3:
is_need_refresh, areas = get_tixcraft_target_area(el, area_keyword_3, area_auto_select_mode, pass_1_seat_remaining_enable)
is_need_refresh, areas = get_tixcraft_target_area(el, area_keyword_3, area_auto_select_mode, pass_1_seat_remaining_enable, area_keyword_exclude)
if show_debug_message:
print("is_need_refresh for keyword3:", is_need_refresh)
@ -1728,7 +1661,7 @@ def tixcraft_area_auto_select(driver, url, config_dict):
# only when keyword#4 filled to query.
if area_keyword_4_enable:
if area_keyword_1 != area_keyword_4:
is_need_refresh, areas = get_tixcraft_target_area(el, area_keyword_4, area_auto_select_mode, pass_1_seat_remaining_enable)
is_need_refresh, areas = get_tixcraft_target_area(el, area_keyword_4, area_auto_select_mode, pass_1_seat_remaining_enable, area_keyword_exclude)
if show_debug_message:
print("is_need_refresh for keyword4:", is_need_refresh)
@ -3557,7 +3490,7 @@ def kktix_reg_new(driver, url, answer_index, kktix_register_status_last, config_
# PURPOSE: get target area list.
# PS: this is main block, use keyword to get rows.
# PS: it seems use date_auto_select_mode instead of area_auto_select_mode
def get_fami_target_area(driver, date_keyword, area_keyword_1, area_keyword_2, area_keyword_3, area_keyword_4, area_auto_select_mode):
def get_fami_target_area(driver, date_keyword, area_keyword_1, area_keyword_2, area_keyword_3, area_keyword_4, area_auto_select_mode, area_keyword_exclude):
show_debug_message = True # debug.
show_debug_message = False # online
@ -3650,6 +3583,11 @@ def get_fami_target_area(driver, date_keyword, area_keyword_1, area_keyword_2, a
if row_text is None:
row_text = ""
if len(row_text) > 0:
if len(area_keyword_exclude) > 0:
if area_keyword_exclude in row_text:
row_text = ""
if len(row_text) > 0:
# check date.
is_match_date = False
@ -3752,6 +3690,11 @@ def fami_home(driver, url, config_dict):
area_keyword_2 = config_dict["tixcraft"]["area_auto_select"]["area_keyword_2"].strip()
area_keyword_3 = config_dict["tixcraft"]["area_auto_select"]["area_keyword_3"].strip()
area_keyword_4 = config_dict["tixcraft"]["area_auto_select"]["area_keyword_4"].strip()
area_keyword_exclude = config_dict["tixcraft"]["area_auto_select"]["area_keyword_exclude"]
area_keyword_2_enable = config_dict["tixcraft"]["area_auto_select"]["area_keyword_2_enable"]
area_keyword_3_enable = config_dict["tixcraft"]["area_auto_select"]["area_keyword_3_enable"]
area_keyword_4_enable = config_dict["tixcraft"]["area_auto_select"]["area_keyword_4_enable"]
#---------------------------
# part 3: fill ticket number.
@ -3843,7 +3786,7 @@ def fami_home(driver, url, config_dict):
#---------------------------
# part 2: select keywords
#---------------------------
areas = get_fami_target_area(driver, date_keyword, area_keyword_1, area_keyword_2, area_keyword_3, area_keyword_4, area_auto_select_mode)
areas = get_fami_target_area(driver, date_keyword, area_keyword_1, area_keyword_2, area_keyword_3, area_keyword_4, area_auto_select_mode, area_keyword_exclude)
area_target = None
if areas is not None:
@ -4085,7 +4028,7 @@ def urbtix_purchase_ticket(driver, config_dict):
return is_date_assign_by_bot
# purpose: area auto select
def urbtix_area_auto_select(driver, area_auto_select_mode, area_keyword_1, area_keyword_1_and):
def urbtix_area_auto_select(driver, area_auto_select_mode, area_keyword_1, area_keyword_1_and, area_keyword_exclude):
show_debug_message = True # debug.
show_debug_message = False # online
@ -4178,6 +4121,11 @@ def urbtix_area_auto_select(driver, area_auto_select_mode, area_keyword_1, area_
if row_text is None:
row_text = ""
if len(row_text) > 0:
if len(area_keyword_exclude) > 0:
if area_keyword_exclude in row_text:
row_text = ""
if len(row_text) > 0:
row_text = format_keyword_string(row_text)
if show_debug_message:
@ -4369,31 +4317,33 @@ def urbtix_performance(driver, config_dict):
area_keyword_2 = config_dict["tixcraft"]["area_auto_select"]["area_keyword_2"].strip()
area_keyword_3 = config_dict["tixcraft"]["area_auto_select"]["area_keyword_3"].strip()
area_keyword_4 = config_dict["tixcraft"]["area_auto_select"]["area_keyword_4"].strip()
area_keyword_1_and = ""
area_keyword_2_and = ""
area_keyword_exclude = config_dict["tixcraft"]["area_auto_select"]["area_keyword_exclude"]
area_keyword_2_enable = config_dict["tixcraft"]["area_auto_select"]["area_keyword_2_enable"]
area_keyword_3_enable = config_dict["tixcraft"]["area_auto_select"]["area_keyword_3_enable"]
area_keyword_4_enable = config_dict["tixcraft"]["area_auto_select"]["area_keyword_4_enable"]
if show_debug_message:
print("area_keyword_1:", area_keyword_1)
#print("area_keyword_1_and:", area_keyword_1_and)
print("area_keyword_2:", area_keyword_2)
#print("area_keyword_2_and:", area_keyword_2_and)
is_need_refresh, is_price_assign_by_bot = urbtix_area_auto_select(driver, area_auto_select_mode, area_keyword_1, area_keyword_1_and)
is_need_refresh, is_price_assign_by_bot = urbtix_area_auto_select(driver, area_auto_select_mode, area_keyword_1, "", area_keyword_exclude)
if is_need_refresh:
if area_keyword_2_enable:
if area_keyword_1 != area_keyword_2:
if len(area_keyword_2) > 0:
is_need_refresh, is_price_assign_by_bot = urbtix_area_auto_select(driver, area_auto_select_mode, area_keyword_2, "", area_keyword_exclude)
if not is_need_refresh:
if not is_price_assign_by_bot:
# try keyword_2
if len(area_keyword_2) > 0:
is_need_refresh, is_price_assign_by_bot = urbtix_area_auto_select(driver, area_auto_select_mode, area_keyword_2, area_keyword_2_and)
if is_need_refresh:
if area_keyword_3_enable:
if area_keyword_1 != area_keyword_3:
if len(area_keyword_3) > 0:
is_need_refresh, is_price_assign_by_bot = urbtix_area_auto_select(driver, area_auto_select_mode, area_keyword_3, "", area_keyword_exclude)
if not is_need_refresh:
if not is_price_assign_by_bot:
if len(area_keyword_3) > 0:
is_need_refresh, is_price_assign_by_bot = urbtix_area_auto_select(driver, area_auto_select_mode, area_keyword_3, "")
if not is_need_refresh:
if not is_price_assign_by_bot:
if len(area_keyword_4) > 0:
is_need_refresh, is_price_assign_by_bot = urbtix_area_auto_select(driver, area_auto_select_mode, area_keyword_4, "")
if is_need_refresh:
if area_keyword_4_enable:
if area_keyword_1 != area_keyword_4:
if len(area_keyword_4) > 0:
is_need_refresh, is_price_assign_by_bot = urbtix_area_auto_select(driver, area_auto_select_mode, area_keyword_4, "", area_keyword_exclude)
# un-tested. disable refresh for now.
is_need_refresh = False
@ -4573,7 +4523,7 @@ def cityline_date_auto_select(driver, auto_select_mode, date_keyword, auto_reloa
# True: area block appear.
# False: area block not appear.
# ps: return is successfully click on the price radio.
def cityline_area_auto_select(driver, area_auto_select_mode, area_keyword_1, area_keyword_1_and):
def cityline_area_auto_select(driver, area_auto_select_mode, area_keyword_1, area_keyword_1_and, area_keyword_exclude):
show_debug_message = True # debug.
show_debug_message = False # online
@ -4663,6 +4613,11 @@ def cityline_area_auto_select(driver, area_auto_select_mode, area_keyword_1, are
if row_text is None:
row_text = ""
if len(row_text) > 0:
if len(area_keyword_exclude) > 0:
if area_keyword_exclude in row_text:
row_text = ""
if len(row_text) > 0:
row_text = format_keyword_string(row_text)
if show_debug_message:
@ -4896,8 +4851,12 @@ def cityline_performance(driver, config_dict):
area_keyword_2 = config_dict["tixcraft"]["area_auto_select"]["area_keyword_2"].strip()
area_keyword_3 = config_dict["tixcraft"]["area_auto_select"]["area_keyword_3"].strip()
area_keyword_4 = config_dict["tixcraft"]["area_auto_select"]["area_keyword_4"].strip()
area_keyword_1_and = ""
area_keyword_2_and = ""
area_keyword_exclude = config_dict["tixcraft"]["area_auto_select"]["area_keyword_exclude"]
area_keyword_2_enable = config_dict["tixcraft"]["area_auto_select"]["area_keyword_2_enable"]
area_keyword_3_enable = config_dict["tixcraft"]["area_auto_select"]["area_keyword_3_enable"]
area_keyword_4_enable = config_dict["tixcraft"]["area_auto_select"]["area_keyword_4_enable"]
if show_debug_message:
print("area_keyword_1:", area_keyword_1)
@ -4906,23 +4865,25 @@ def cityline_performance(driver, config_dict):
#print("area_keyword_2_and:", area_keyword_2_and)
# PS: cityline price default value is selected at the first option.
is_need_refresh, is_price_assign_by_bot = cityline_area_auto_select(driver, area_auto_select_mode, area_keyword_1, area_keyword_1_and)
is_need_refresh, is_price_assign_by_bot = cityline_area_auto_select(driver, area_auto_select_mode, area_keyword_1, "", area_keyword_exclude)
if not is_need_refresh:
if not is_price_assign_by_bot:
# try keyword_2
if len(area_keyword_2) > 0:
is_need_refresh, is_price_assign_by_bot = cityline_area_auto_select(driver, area_auto_select_mode, area_keyword_2, area_keyword_2_and)
if is_need_refresh:
if area_keyword_2_enable:
if area_keyword_1 != area_keyword_2:
if len(area_keyword_2) > 0:
is_need_refresh, is_price_assign_by_bot = cityline_area_auto_select(driver, area_auto_select_mode, area_keyword_2, "", area_keyword_exclude)
if not is_need_refresh:
if not is_price_assign_by_bot:
if len(area_keyword_3) > 0:
is_need_refresh, is_price_assign_by_bot = cityline_area_auto_select(driver, area_auto_select_mode, area_keyword_3, "")
if is_need_refresh:
if area_keyword_3_enable:
if area_keyword_1 != area_keyword_3:
if len(area_keyword_3) > 0:
is_need_refresh, is_price_assign_by_bot = cityline_area_auto_select(driver, area_auto_select_mode, area_keyword_3, "", area_keyword_exclude)
if not is_need_refresh:
if not is_price_assign_by_bot:
if len(area_keyword_4) > 0:
is_need_refresh, is_price_assign_by_bot = cityline_area_auto_select(driver, area_auto_select_mode, area_keyword_4, "")
if is_need_refresh:
if area_keyword_4_enable:
if area_keyword_1 != area_keyword_4:
if len(area_keyword_4) > 0:
is_need_refresh, is_price_assign_by_bot = cityline_area_auto_select(driver, area_auto_select_mode, area_keyword_4, "", area_keyword_exclude)
# un-tested. disable refresh for now.
is_need_refresh = False
@ -5140,7 +5101,7 @@ def ibon_activity_info(driver, config_dict):
return is_date_assign_by_bot
def ibon_area_auto_select(driver, config_dict, area_keyword_1, area_keyword_1_and):
def ibon_area_auto_select(driver, config_dict, area_keyword_1, area_keyword_1_and, area_keyword_exclude):
show_debug_message = True # debug.
show_debug_message = False # online
@ -5254,6 +5215,11 @@ def ibon_area_auto_select(driver, config_dict, area_keyword_1, area_keyword_1_an
if row_text is None:
row_text = ""
if len(row_text) > 0:
if len(area_keyword_exclude) > 0:
if area_keyword_exclude in row_text:
row_text = ""
if len(row_text) > 0:
row_text = format_keyword_string(row_text)
if show_debug_message:
@ -5352,6 +5318,8 @@ def ibon_performance(driver, config_dict):
area_keyword_3_and = ""
area_keyword_4_and = ""
area_keyword_exclude = config_dict["tixcraft"]["area_auto_select"]["area_keyword_exclude"]
area_keyword_2_enable = config_dict["tixcraft"]["area_auto_select"]["area_keyword_2_enable"]
area_keyword_3_enable = config_dict["tixcraft"]["area_auto_select"]["area_keyword_3_enable"]
area_keyword_4_enable = config_dict["tixcraft"]["area_auto_select"]["area_keyword_4_enable"]
@ -5363,29 +5331,28 @@ def ibon_performance(driver, config_dict):
#print("area_keyword_2_and:", area_keyword_2_and)
is_need_refresh = False
if not is_price_assign_by_bot:
is_need_refresh, is_price_assign_by_bot = ibon_area_auto_select(driver, config_dict, area_keyword_1, area_keyword_1_and)
is_need_refresh, is_price_assign_by_bot = ibon_area_auto_select(driver, config_dict, area_keyword_1, area_keyword_1_and, area_keyword_exclude)
if is_need_refresh:
if area_keyword_2_enable:
if area_keyword_1 != area_keyword_2:
is_need_refresh, is_price_assign_by_bot = ibon_area_auto_select(driver, config_dict, area_keyword_2, area_keyword_2_and)
if show_debug_message:
print("is_need_refresh for keyword2:", is_need_refresh)
if is_need_refresh:
if area_keyword_2_enable:
if area_keyword_1 != area_keyword_2:
is_need_refresh, is_price_assign_by_bot = ibon_area_auto_select(driver, config_dict, area_keyword_2, area_keyword_2_and, area_keyword_exclude)
if show_debug_message:
print("is_need_refresh for keyword2:", is_need_refresh)
if is_need_refresh:
if area_keyword_3_enable:
if area_keyword_1 != area_keyword_3:
is_need_refresh, is_price_assign_by_bot = ibon_area_auto_select(driver, config_dict, area_keyword_3, area_keyword_3_and)
if show_debug_message:
print("is_need_refresh for keyword3:", is_need_refresh)
if is_need_refresh:
if area_keyword_3_enable:
if area_keyword_1 != area_keyword_3:
is_need_refresh, is_price_assign_by_bot = ibon_area_auto_select(driver, config_dict, area_keyword_3, area_keyword_3_and, area_keyword_exclude)
if show_debug_message:
print("is_need_refresh for keyword3:", is_need_refresh)
if is_need_refresh:
if area_keyword_4_enable:
if area_keyword_1 != area_keyword_4:
is_need_refresh, is_price_assign_by_bot = ibon_area_auto_select(driver, config_dict, area_keyword_4, area_keyword_4_and)
if show_debug_message:
print("is_need_refresh for keyword4:", is_need_refresh)
if is_need_refresh:
if area_keyword_4_enable:
if area_keyword_1 != area_keyword_4:
is_need_refresh, is_price_assign_by_bot = ibon_area_auto_select(driver, config_dict, area_keyword_4, area_keyword_4_and, area_keyword_exclude)
if show_debug_message:
print("is_need_refresh for keyword4:", is_need_refresh)
if is_need_refresh:
try:
@ -6991,7 +6958,7 @@ def hkticketing_show(driver, config_dict):
return is_date_submiting
def hkticketing_area_auto_select(driver, area_auto_select_mode, area_keyword_1, area_keyword_1_and):
def hkticketing_area_auto_select(driver, area_auto_select_mode, area_keyword_1, area_keyword_1_and, area_keyword_exclude):
show_debug_message = True # debug.
show_debug_message = False # online
@ -7083,6 +7050,11 @@ def hkticketing_area_auto_select(driver, area_auto_select_mode, area_keyword_1,
if row_text is None:
row_text = ""
if len(row_text) > 0:
if len(area_keyword_exclude) > 0:
if area_keyword_exclude in row_text:
row_text = ""
if len(row_text) > 0:
row_text = format_keyword_string(row_text)
if show_debug_message:
@ -7306,8 +7278,12 @@ def hkticketing_performance(driver, config_dict, domain_name):
area_keyword_2 = config_dict["tixcraft"]["area_auto_select"]["area_keyword_2"].strip()
area_keyword_3 = config_dict["tixcraft"]["area_auto_select"]["area_keyword_3"].strip()
area_keyword_4 = config_dict["tixcraft"]["area_auto_select"]["area_keyword_4"].strip()
area_keyword_1_and = ""
area_keyword_2_and = ""
area_keyword_exclude = config_dict["tixcraft"]["area_auto_select"]["area_keyword_exclude"]
area_keyword_2_enable = config_dict["tixcraft"]["area_auto_select"]["area_keyword_2_enable"]
area_keyword_3_enable = config_dict["tixcraft"]["area_auto_select"]["area_keyword_3_enable"]
area_keyword_4_enable = config_dict["tixcraft"]["area_auto_select"]["area_keyword_4_enable"]
if show_debug_message:
print("area_keyword_1:", area_keyword_1)
@ -7317,22 +7293,25 @@ def hkticketing_performance(driver, config_dict, domain_name):
is_need_refresh = False
if not is_price_assign_by_bot:
is_need_refresh, is_price_assign_by_bot = hkticketing_area_auto_select(driver, area_auto_select_mode, area_keyword_1, area_keyword_1_and)
is_need_refresh, is_price_assign_by_bot = hkticketing_area_auto_select(driver, area_auto_select_mode, area_keyword_1, "", area_keyword_exclude)
if not is_need_refresh:
if not is_price_assign_by_bot:
# try keyword_2
if len(area_keyword_2) > 0:
is_need_refresh, is_price_assign_by_bot = hkticketing_area_auto_select(driver, area_auto_select_mode, area_keyword_2, area_keyword_2_and)
if is_need_refresh:
if area_keyword_2_enable:
if area_keyword_1 != area_keyword_2:
if len(area_keyword_2) > 0:
is_need_refresh, is_price_assign_by_bot = hkticketing_area_auto_select(driver, area_auto_select_mode, area_keyword_2, "", area_keyword_exclude)
if not is_need_refresh:
if not is_price_assign_by_bot:
if len(area_keyword_3) > 0:
is_need_refresh, is_price_assign_by_bot = hkticketing_area_auto_select(driver, area_auto_select_mode, area_keyword_3, "")
if not is_need_refresh:
if not is_price_assign_by_bot:
if len(area_keyword_4) > 0:
is_need_refresh, is_price_assign_by_bot = hkticketing_area_auto_select(driver, area_auto_select_mode, area_keyword_4, "")
if is_need_refresh:
if area_keyword_3_enable:
if area_keyword_1 != area_keyword_3:
if len(area_keyword_3) > 0:
is_need_refresh, is_price_assign_by_bot = hkticketing_area_auto_select(driver, area_auto_select_mode, area_keyword_3, "", area_keyword_exclude)
if is_need_refresh:
if area_keyword_4_enable:
if area_keyword_1 != area_keyword_4:
if len(area_keyword_4) > 0:
is_need_refresh, is_price_assign_by_bot = hkticketing_area_auto_select(driver, area_auto_select_mode, area_keyword_4, "", area_keyword_exclude)
if is_need_refresh:
if show_debug_message:
@ -7705,6 +7684,7 @@ def kham_area_auto_select(driver, config_dict, area_keyword_1, area_keyword_1_an
show_debug_message = True
area_auto_select_mode = config_dict["tixcraft"]["area_auto_select"]["mode"]
area_keyword_exclude = config_dict["tixcraft"]["area_auto_select"]["area_keyword_exclude"]
is_price_assign_by_bot = False
is_need_refresh = False
@ -7717,7 +7697,7 @@ def kham_area_auto_select(driver, config_dict, area_keyword_1, area_keyword_1_an
area_list = None
try:
my_css_selector = "table#salesTable > tbody > tr"
my_css_selector = "table#salesTable > tbody > tr.status_tr"
area_list = driver.find_elements(By.CSS_SELECTOR, my_css_selector)
except Exception as exc:
print("find #ticket-price-tbl date list fail")
@ -7735,7 +7715,6 @@ def kham_area_auto_select(driver, config_dict, area_keyword_1, area_keyword_1_an
# TODO://
# ...
formated_area_list = None
if area_list is not None:
area_list_count = len(area_list)
@ -7748,18 +7727,27 @@ def kham_area_auto_select(driver, config_dict, area_keyword_1, area_keyword_1_an
row_index = 0
for row in area_list:
row_index += 1
row_is_sold_out=False
row_is_enabled=True
try:
row_text = row.text
if row_text is None:
row_text = ""
if '售完' in row_text:
row_is_sold_out = True
if len(row_text) == 0:
row_is_enabled = False
else:
if '售完' in row_text:
row_is_enabled = False
if len(area_keyword_exclude) > 0:
if area_keyword_exclude in row_text:
row_is_enabled = False
except Exception as exc:
pass
row_is_enabled=False
if not row_is_sold_out:
if row_is_enabled:
pass
# too many rows, too slow, disable to check.
'''
try:
is_row_with_id = False
tr_id_string = str(row.get_attribute('id'))
@ -7769,6 +7757,7 @@ def kham_area_auto_select(driver, config_dict, area_keyword_1, area_keyword_1_an
row_is_enabled=True
except Exception as exc:
pass
'''
if row_is_enabled:
formated_area_list.append(row)
@ -7892,14 +7881,16 @@ def kham_area_auto_select(driver, config_dict, area_keyword_1, area_keyword_1_an
return is_need_refresh, is_price_assign_by_bot
def kham_performance_ticket_number(driver, ticket_number):
ret = False
def kham_performance_ticket_number(driver, config_dict):
is_ticket_number_assigned = False
ticket_number = config_dict["ticket_number"]
form_input = None
try:
form_input = driver.find_element(By.CSS_SELECTOR, 'td.tdtext_orangeunderline > input[type="text"]')
form_input = driver.find_element(By.CSS_SELECTOR, '#AMOUNT')
except Exception as exc:
#print("find modal-dialog fail")
print("find #AMOUNT fail")
#print(exc)
pass
@ -7908,13 +7899,13 @@ def kham_performance_ticket_number(driver, ticket_number):
try:
inputed_value = form_input.get_attribute('value')
except Exception as exc:
print("find verify code fail")
print("get_attribute value fail")
pass
if inputed_value is None:
inputed_value = ""
if inputed_value == "":
if inputed_value == "" or inputed_value == "0":
is_visible = False
try:
if form_input.is_enabled():
@ -7925,8 +7916,9 @@ def kham_performance_ticket_number(driver, ticket_number):
if is_visible:
try:
form_input.click()
form_input.clear()
form_input.send_keys(str(ticket_number))
ret = True
is_ticket_number_assigned = True
except Exception as exc:
# use plan B
'''
@ -7939,7 +7931,50 @@ def kham_performance_ticket_number(driver, ticket_number):
'''
pass
return ret
if len(inputed_value) > 0:
if not inputed_value=="0":
is_ticket_number_assigned = True
return is_ticket_number_assigned
def kham_choice_auto_seat(driver):
is_switch_to_auto_seat = False
btn_switch_to_auto_seat = None
try:
my_css_selector = '#BUY_TYPE_2'
btn_switch_to_auto_seat = driver.find_element(By.CSS_SELECTOR, my_css_selector)
except Exception as exc:
#print("find BUY_TYPE_2 input fail")
pass
if btn_switch_to_auto_seat is not None:
button_class_string = None
try:
button_class_string = form_verifyCode.get_attribute('class')
except Exception as exc:
#print("get_attribute('class') fail")
pass
if button_class_string is None:
button_class_string = ""
if button_class_string == "":
try:
btn_switch_to_auto_seat.click()
is_switch_to_auto_seat = True
except Exception as exc:
try:
driver.execute_script("arguments[0].click();", btn_switch_to_auto_seat)
ret = True
except Exception as exc:
pass
if button_class_string == "red":
is_switch_to_auto_seat = True
return is_switch_to_auto_seat
def kham_performance(driver, config_dict, ocr, Captcha_Browser, model_name):
show_debug_message = True # debug.
@ -7958,8 +7993,10 @@ def kham_performance(driver, config_dict, ocr, Captcha_Browser, model_name):
area_keyword_2 = config_dict["tixcraft"]["area_auto_select"]["area_keyword_2"].strip()
area_keyword_3 = config_dict["tixcraft"]["area_auto_select"]["area_keyword_3"].strip()
area_keyword_4 = config_dict["tixcraft"]["area_auto_select"]["area_keyword_4"].strip()
area_keyword_1_and = ""
area_keyword_2_and = ""
area_keyword_2_enable = config_dict["tixcraft"]["area_auto_select"]["area_keyword_2_enable"]
area_keyword_3_enable = config_dict["tixcraft"]["area_auto_select"]["area_keyword_3_enable"]
area_keyword_4_enable = config_dict["tixcraft"]["area_auto_select"]["area_keyword_4_enable"]
ticket_number = config_dict["ticket_number"]
@ -7971,23 +8008,25 @@ def kham_performance(driver, config_dict, ocr, Captcha_Browser, model_name):
print("ticket_number:", ticket_number)
is_need_refresh = False
if not is_price_assign_by_bot:
is_need_refresh, is_price_assign_by_bot = kham_area_auto_select(driver, config_dict, area_keyword_1, area_keyword_1_and, ticket_number)
is_need_refresh, is_price_assign_by_bot = kham_area_auto_select(driver, config_dict, area_keyword_1, "", ticket_number)
if not is_need_refresh:
if not is_price_assign_by_bot:
# try keyword_2
if len(area_keyword_2) > 0:
is_need_refresh, is_price_assign_by_bot = kham_area_auto_select(driver, config_dict, area_keyword_2, area_keyword_2_and, ticket_number)
if is_need_refresh:
if area_keyword_2_enable:
if area_keyword_1 != area_keyword_2:
if len(area_keyword_2) > 0:
is_need_refresh, is_price_assign_by_bot = kham_area_auto_select(driver, config_dict, area_keyword_2, "", ticket_number)
if not is_need_refresh:
if not is_price_assign_by_bot:
if len(area_keyword_3) > 0:
is_need_refresh, is_price_assign_by_bot = kham_area_auto_select(driver, config_dict, area_keyword_3, "", ticket_number)
if not is_need_refresh:
if not is_price_assign_by_bot:
if len(area_keyword_4) > 0:
is_need_refresh, is_price_assign_by_bot = kham_area_auto_select(driver, config_dict, area_keyword_4, "", ticket_number)
if is_need_refresh:
if area_keyword_3_enable:
if area_keyword_1 != area_keyword_3:
if len(area_keyword_3) > 0:
is_need_refresh, is_price_assign_by_bot = kham_area_auto_select(driver, config_dict, area_keyword_3, "", ticket_number)
if is_need_refresh:
if area_keyword_4_enable:
if area_keyword_1 != area_keyword_4:
if len(area_keyword_4) > 0:
is_need_refresh, is_price_assign_by_bot = kham_area_auto_select(driver, config_dict, area_keyword_4, "", ticket_number)
if is_need_refresh:
if show_debug_message:
@ -7997,33 +8036,16 @@ def kham_performance(driver, config_dict, ocr, Captcha_Browser, model_name):
except Exception as exc:
pass
# special case for UTK0202 model.
is_ticket_number_assigned = kham_performance_ticket_number(driver, ticket_number)
if is_ticket_number_assigned:
is_captcha_sent = kham_captcha(driver, config_dict, ocr, Captcha_Browser, model_name)
if is_captcha_sent:
el_btn = None
try:
my_css_selector = 'input[onclick="return chkCart();"]'
el_btn = driver.find_element(By.CSS_SELECTOR, my_css_selector)
if not el_btn is None:
el_btn.click()
except Exception as exc:
print("find chkCart button fail")
pass
is_captcha_sent = kham_captcha(driver, config_dict, ocr, Captcha_Browser, model_name)
return is_price_assign_by_bot
def kham_keyin_captcha_code(driver, answer = "", auto_submit = False):
is_verifyCode_editing = False
is_form_sumbited = False
# manually keyin verify code.
# start to input verify code.
form_verifyCode = None
try:
#my_css_selector = 'table#blockLogin > tbody > tr > td > input[type="text"]'
my_css_selector = 'input[value="驗證碼"]'
form_verifyCode = driver.find_element(By.CSS_SELECTOR, my_css_selector)
except Exception as exc:
@ -8078,20 +8100,10 @@ def kham_keyin_captcha_code(driver, answer = "", auto_submit = False):
answer=answer.upper()
form_verifyCode.clear()
form_verifyCode.send_keys(answer)
if auto_submit:
form_verifyCode.send_keys(Keys.ENTER)
is_verifyCode_editing = False
is_form_sumbited = True
else:
print("select all captcha text")
driver.execute_script("arguments[0].select();", form_verifyCode)
if len(answer) > 0:
#tixcraft_toast(driver, "※ 按 Enter 如果答案是: " + answer)
pass
except Exception as exc:
print("send_keys ocr answer fail.")
return is_verifyCode_editing, is_form_sumbited
return is_verifyCode_editing
def kham_auto_ocr(driver, config_dict, ocr, away_from_keyboard_enable, previous_answer, Captcha_Browser, ocr_captcha_image_source, model_name):
show_debug_message = True # debug.
@ -8152,11 +8164,10 @@ def kham_auto_ocr(driver, config_dict, ocr, away_from_keyboard_enable, previous_
ocr_answer = ocr_answer.strip()
print("ocr_answer:", ocr_answer)
if len(ocr_answer)==4:
who_care_var, is_form_sumbited = kham_keyin_captcha_code(driver, answer = ocr_answer, auto_submit = away_from_keyboard_enable)
who_care_var = kham_keyin_captcha_code(driver, answer = ocr_answer, auto_submit = away_from_keyboard_enable)
else:
if not away_from_keyboard_enable:
kham_keyin_captcha_code(driver)
#tixcraft_toast(driver, "※ OCR辨識失敗Q_Q驗證碼請手動輸入...")
else:
is_need_redo_ocr = True
if previous_answer != ocr_answer:
@ -8196,7 +8207,7 @@ def kham_captcha(driver, config_dict, ocr, Captcha_Browser, model_name):
away_from_keyboard_enable = False
ocr_captcha_image_source = config_dict["ocr_captcha"]["image_source"]
#PS: need a 'auto assign site' feature to enable away_from_keyboard feature.
#PS: need a 'auto assign seat' feature to enable away_from_keyboard feature.
away_from_keyboard_enable = False
is_cpatcha_sent = False
@ -8273,6 +8284,7 @@ def kham_main(driver, url, config_dict, ocr, Captcha_Browser):
# https://kham.com.tw/application/UTK02/UTK0204_.aspx?PERFORMANCE_ID=N28UQPA1&PRODUCT_ID=N28TFATD
if '.aspx?performance_id=' in url.lower() and 'product_id=' in url.lower():
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR,'div.ui-dialog-buttonset > button.ui-button')
area_auto_select_enable = config_dict["tixcraft"]["area_auto_select"]["enable"]
if area_auto_select_enable:
domain_name = url.split('/')[2]
@ -8284,8 +8296,7 @@ def kham_main(driver, url, config_dict, ocr, Captcha_Browser):
if not Captcha_Browser is None:
Captcha_Browser.Set_Domain(domain_name, captcha_url=captcha_url)
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR,'div.ui-dialog-buttonset > button.ui-button')
is_switch_to_auto_seat = kham_choice_auto_seat(driver)
kham_performance(driver, config_dict, ocr, Captcha_Browser, model_name)
#https://kham.com.tw/application/UTK02/UTK0205_.aspx?PERFORMANCE_ID=XXX&GROUP_ID=30&PERFORMANCE_PRICE_AREA_ID=XXX
@ -8301,9 +8312,22 @@ def kham_main(driver, url, config_dict, ocr, Captcha_Browser):
if not Captcha_Browser is None:
Captcha_Browser.Set_Domain(domain_name, captcha_url=captcha_url)
kham_captcha(driver, config_dict, ocr, Captcha_Browser, model_name)
is_ticket_number_assigned = kham_performance_ticket_number(driver, config_dict)
if is_ticket_number_assigned:
is_captcha_sent = kham_captcha(driver, config_dict, ocr, Captcha_Browser, model_name)
if is_captcha_sent:
el_btn = None
try:
my_css_selector = 'button[onclick="addShoppingCart();return false;"]'
el_btn = driver.find_element(By.CSS_SELECTOR, my_css_selector)
if not el_btn is None:
el_btn.click()
except Exception as exc:
print("find chkCart button fail")
pass
if '/application/utk13/utk1306_.aspx' in url.lower():
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR,'div.ui-dialog-buttonset > button.ui-button')
if config_dict["ocr_captcha"]["enable"]:
domain_name = url.split('/')[2]
model_name = url.split('/')[5]
@ -8839,7 +8863,8 @@ def main(args):
try:
if config_dict["ocr_captcha"]["enable"]:
ocr_beta_mode = True
#ocr_beta_mode = False
if "ticketplus" in config_dict["homepage"]:
ocr_beta_mode = False
ocr = ddddocr.DdddOcr(show_ad=False, beta=ocr_beta_mode)
Captcha_Browser = NonBrowser()

View File

@ -22,7 +22,7 @@ import base64
import threading
import subprocess
CONST_APP_VERSION = u"MaxBot (2023.03.14)"
CONST_APP_VERSION = u"MaxBot (2023.03.20)"
CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json"
CONST_MAXBOT_CONFIG_FILE = "settings.json"

View File

@ -1 +1 @@
{"homepage": "https://tixcraft.com", "browser": "chrome", "language": "\u7e41\u9ad4\u4e2d\u6587", "ticket_number": 2, "pass_1_seat_remaining": true, "auto_check_agree": true, "ocr_captcha": {"enable": true, "force_submit": false, "image_source": "canvas"}, "webdriver_type": "undetected_chromedriver", "kktix": {"auto_press_next_step_button": true, "auto_fill_ticket_number": true, "area_mode": "from top to bottom", "area_keyword_1": "", "area_keyword_1_and": "", "area_keyword_2": "", "area_keyword_2_and": "", "area_keyword_2_enable": true, "auto_guess_options": true, "user_guess_string": ""}, "tixcraft": {"date_auto_select": {"enable": true, "date_keyword": "", "mode": "from top to bottom"}, "area_auto_select": {"enable": true, "area_keyword_1": "", "area_keyword_2": "", "area_keyword_3": "", "area_keyword_4": "", "area_keyword_2_enable": true, "area_keyword_3_enable": true, "area_keyword_4_enable": true, "mode": "from top to bottom"}, "pass_date_is_sold_out": true, "auto_reload_coming_soon_page": true, "presale_code": "", "presale_code_delimiter": ""}, "advanced": {"play_captcha_sound": {"enable": true, "filename": "ding-dong.wav"}, "tixcraft_sid": "", "ibonqware": "", "facebook_account": "", "kktix_account": "", "cityline_account": "", "urbtix_account": "", "hkticketing_account": "", "kham_account": "", "facebook_password": "", "kktix_password": "", "cityline_password": "", "urbtix_password": "", "hkticketing_password": "", "kham_password": "", "adblock_plus_enable": false, "open_google_oauth_url": false, "headless": false, "verbose": false}}
{"homepage": "https://tixcraft.com", "browser": "chrome", "language": "\u7e41\u9ad4\u4e2d\u6587", "ticket_number": 2, "pass_1_seat_remaining": true, "auto_check_agree": true, "ocr_captcha": {"enable": true, "force_submit": false, "image_source": "canvas"}, "webdriver_type": "undetected_chromedriver", "kktix": {"auto_press_next_step_button": true, "auto_fill_ticket_number": true, "area_mode": "from top to bottom", "area_keyword_1": "", "area_keyword_1_and": "", "area_keyword_2": "", "area_keyword_2_and": "", "area_keyword_2_enable": true, "area_keyword_exclude": "\u8f2a\u6905", "auto_guess_options": true, "user_guess_string": ""}, "tixcraft": {"date_auto_select": {"enable": true, "date_keyword": "", "mode": "from top to bottom"}, "area_auto_select": {"enable": true, "area_keyword_1": "", "area_keyword_2": "", "area_keyword_3": "", "area_keyword_4": "", "area_keyword_exclude": "\u8f2a\u6905", "area_keyword_2_enable": true, "area_keyword_3_enable": true, "area_keyword_4_enable": true, "mode": "from top to bottom"}, "pass_date_is_sold_out": true, "auto_reload_coming_soon_page": true, "presale_code": "", "presale_code_delimiter": ""}, "advanced": {"play_captcha_sound": {"enable": true, "filename": "ding-dong.wav"}, "tixcraft_sid": "", "ibonqware": "", "facebook_account": "", "kktix_account": "", "cityline_account": "", "urbtix_account": "", "hkticketing_account": "", "kham_account": "", "facebook_password": "", "kktix_password": "", "cityline_password": "", "urbtix_password": "", "hkticketing_password": "", "kham_password": "", "adblock_plus_enable": false, "open_google_oauth_url": false, "headless": false, "verbose": false}}

View File

@ -24,7 +24,7 @@ import time
import threading
import subprocess
CONST_APP_VERSION = u"MaxBot (2023.03.14)"
CONST_APP_VERSION = u"MaxBot (2023.03.20)"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
@ -95,6 +95,7 @@ def load_translate():
en_us["area_keyword_2"] = 'Area Keyword #2'
en_us["area_keyword_3"] = 'Area Keyword #3'
en_us["area_keyword_4"] = 'Area Keyword #4'
en_us["area_keyword_exclude"] = 'Area Keyword Exclude'
en_us["pass_1_seat_remaining"] = 'Pass 1 seat remaining'
en_us["ocr_captcha"] = 'OCR captcha'
en_us["ocr_captcha_force_submit"] = 'Away from keyboard'
@ -186,6 +187,7 @@ def load_translate():
zh_tw["area_keyword_2"] = '區域關鍵字 #2'
zh_tw["area_keyword_3"] = '區域關鍵字 #3'
zh_tw["area_keyword_4"] = '區域關鍵字 #4'
zh_tw["area_keyword_exclude"] = '排除區域關鍵字'
zh_tw["pass_1_seat_remaining"] = '避開「剩餘 1」的區域'
zh_tw["ocr_captcha"] = '猜測驗證碼'
zh_tw["ocr_captcha_force_submit"] = '掛機模式'
@ -276,6 +278,7 @@ def load_translate():
zh_cn["area_keyword_2"] = '区域关键字 #2'
zh_cn["area_keyword_3"] = '区域关键字 #3'
zh_cn["area_keyword_4"] = '区域关键字 #4'
zh_cn["area_keyword_exclude"] = '排除区域关键字'
zh_cn["pass_1_seat_remaining"] = '避开“剩余 1”的区域'
zh_cn["ocr_captcha"] = '猜测验证码'
zh_cn["ocr_captcha_force_submit"] = '挂机模式'
@ -367,6 +370,7 @@ def load_translate():
ja_jp["area_keyword_2"] = 'エリアキーワード #2'
ja_jp["area_keyword_3"] = 'エリアキーワード #3'
ja_jp["area_keyword_4"] = 'エリアキーワード #4'
ja_jp["area_keyword_exclude"] = '除外エリア キーワード'
ja_jp["pass_1_seat_remaining"] = '「1 席残り」エリアは避ける'
ja_jp["ocr_captcha"] = 'キャプチャを推測する'
ja_jp["ocr_captcha_force_submit"] = 'キーボードから離れて'
@ -483,6 +487,7 @@ def get_default_config():
config_dict["kktix"]["area_keyword_2"] = ""
config_dict["kktix"]["area_keyword_2_and"] = ""
config_dict["kktix"]["area_keyword_2_enable"] = True
config_dict["kktix"]["area_keyword_exclude"] = "輪椅"
config_dict["kktix"]["auto_guess_options"] = True
config_dict["kktix"]["user_guess_string"] = ""
@ -496,6 +501,7 @@ def get_default_config():
config_dict["tixcraft"]["area_auto_select"]["area_keyword_2"] = ""
config_dict["tixcraft"]["area_auto_select"]["area_keyword_3"] = ""
config_dict["tixcraft"]["area_auto_select"]["area_keyword_4"] = ""
config_dict["tixcraft"]["area_auto_select"]["area_keyword_exclude"] = "輪椅"
config_dict["tixcraft"]["area_auto_select"]["area_keyword_2_enable"] = True
config_dict["tixcraft"]["area_auto_select"]["area_keyword_3_enable"] = True
@ -677,6 +683,7 @@ def btn_save_act(language_code, slience_mode=False):
global txt_area_keyword_2
global txt_area_keyword_3
global txt_area_keyword_4
global txt_area_keyword_exclude
global combo_date_auto_select_mode
global combo_area_auto_select_mode
@ -773,6 +780,7 @@ def btn_save_act(language_code, slience_mode=False):
config_dict["tixcraft"]["area_auto_select"]["area_keyword_2"] = txt_area_keyword_2.get().strip()
config_dict["tixcraft"]["area_auto_select"]["area_keyword_3"] = txt_area_keyword_3.get().strip()
config_dict["tixcraft"]["area_auto_select"]["area_keyword_4"] = txt_area_keyword_4.get().strip()
config_dict["tixcraft"]["area_auto_select"]["area_keyword_exclude"] = txt_area_keyword_exclude.get().strip()
config_dict["tixcraft"]["area_auto_select"]["area_keyword_2_enable"] = bool(chk_state_area_keyword_2_enable.get())
config_dict["tixcraft"]["area_auto_select"]["area_keyword_3_enable"] = bool(chk_state_area_keyword_3_enable.get())
@ -990,6 +998,7 @@ def applyNewLanguage():
global lbl_area_keyword_2
global lbl_area_keyword_3
global lbl_area_keyword_4
global lbl_area_keyword_exclude
global lbl_pass_date_is_sold_out
global lbl_auto_reload_coming_soon_page
global lbl_presale_code
@ -1066,6 +1075,7 @@ def applyNewLanguage():
lbl_area_keyword_2.config(text=translate[language_code]["area_keyword_2"])
lbl_area_keyword_3.config(text=translate[language_code]["area_keyword_3"])
lbl_area_keyword_4.config(text=translate[language_code]["area_keyword_4"])
lbl_area_keyword_exclude.config(text=translate[language_code]["area_keyword_exclude"])
lbl_pass_date_is_sold_out.config(text=translate[language_code]["pass_date_is_sold_out"])
lbl_auto_reload_coming_soon_page.config(text=translate[language_code]["auto_reload_coming_soon_page"])
lbl_presale_code.config(text=translate[language_code]["user_guess_string"])
@ -1216,7 +1226,6 @@ def showHideBlocks():
showHideTixcraftBlocks()
showHidePass1SeatRemaining()
showHideOcrCaptchaWithSubmit()
def showHideOcrCaptchaWithSubmit():
global chk_state_ocr_captcha
@ -1393,10 +1402,6 @@ def PreferenctTab(root, config_dict, language_code, UI_PADDING_X):
kktix_area_mode = config_dict["kktix"]["area_mode"].strip()
if not kktix_area_mode in CONST_SELECT_OPTIONS_ARRAY:
kktix_area_mode = CONST_SELECT_ORDER_DEFAULT
kktix_area_keyword_1 = config_dict["kktix"]["area_keyword_1"].strip()
kktix_area_keyword_1_and = config_dict["kktix"]["area_keyword_1_and"].strip()
kktix_area_keyword_2 = config_dict["kktix"]["area_keyword_2"].strip()
kktix_area_keyword_2_and = config_dict["kktix"]["area_keyword_2_and"].strip()
auto_guess_options = config_dict["kktix"]["auto_guess_options"]
user_guess_string = config_dict["kktix"]["user_guess_string"].strip()
@ -1418,10 +1423,6 @@ def PreferenctTab(root, config_dict, language_code, UI_PADDING_X):
area_auto_select_mode = config_dict["tixcraft"]["area_auto_select"]["mode"]
if not area_auto_select_mode in CONST_SELECT_OPTIONS_ARRAY:
area_auto_select_mode = CONST_SELECT_ORDER_DEFAULT
area_keyword_1 = config_dict["tixcraft"]["area_auto_select"]["area_keyword_1"].strip()
area_keyword_2 = config_dict["tixcraft"]["area_auto_select"]["area_keyword_2"].strip()
area_keyword_3 = config_dict["tixcraft"]["area_auto_select"]["area_keyword_3"].strip()
area_keyword_4 = config_dict["tixcraft"]["area_auto_select"]["area_keyword_4"].strip()
pass_date_is_sold_out_enable = config_dict["tixcraft"]["pass_date_is_sold_out"]
auto_reload_coming_soon_page_enable = config_dict["tixcraft"]["auto_reload_coming_soon_page"]
@ -1591,7 +1592,7 @@ def PreferenctTab(root, config_dict, language_code, UI_PADDING_X):
lbl_kktix_area_keyword_1.grid(column=0, row=group_row_count, sticky = E)
global txt_kktix_area_keyword_1
txt_kktix_area_keyword_1_value = StringVar(frame_group_kktix, value=kktix_area_keyword_1)
txt_kktix_area_keyword_1_value = StringVar(frame_group_kktix, value=config_dict["kktix"]["area_keyword_1"].strip())
txt_kktix_area_keyword_1 = Entry(frame_group_kktix, width=20, textvariable = txt_kktix_area_keyword_1_value)
txt_kktix_area_keyword_1.grid(column=1, row=group_row_count, sticky = W)
@ -1610,7 +1611,7 @@ def PreferenctTab(root, config_dict, language_code, UI_PADDING_X):
lbl_kktix_area_keyword_1_tmp.grid(column=0, row=group_row_count, sticky = E)
global txt_kktix_area_keyword_1_and
txt_kktix_area_keyword_1_and_value = StringVar(frame_group_kktix, value=kktix_area_keyword_1_and)
txt_kktix_area_keyword_1_and_value = StringVar(frame_group_kktix, value=config_dict["kktix"]["area_keyword_1_and"].strip())
txt_kktix_area_keyword_1_and = Entry(frame_group_kktix, width=20, textvariable = txt_kktix_area_keyword_1_and_value)
txt_kktix_area_keyword_1_and.grid(column=1, row=group_row_count, sticky = W)
@ -1621,7 +1622,7 @@ def PreferenctTab(root, config_dict, language_code, UI_PADDING_X):
lbl_kktix_area_keyword_2.grid(column=0, row=group_row_count, sticky = E)
global txt_kktix_area_keyword_2
txt_kktix_area_keyword_2_value = StringVar(frame_group_kktix, value=kktix_area_keyword_2)
txt_kktix_area_keyword_2_value = StringVar(frame_group_kktix, value=config_dict["kktix"]["area_keyword_2"].strip())
txt_kktix_area_keyword_2 = Entry(frame_group_kktix, width=20, textvariable = txt_kktix_area_keyword_2_value)
txt_kktix_area_keyword_2.grid(column=1, row=group_row_count, sticky = W)
@ -1649,7 +1650,7 @@ def PreferenctTab(root, config_dict, language_code, UI_PADDING_X):
lbl_kktix_area_keyword_2_tmp.grid(column=0, row=group_row_count, sticky = E)
global txt_kktix_area_keyword_2_and
txt_kktix_area_keyword_2_and_value = StringVar(frame_group_kktix, value=kktix_area_keyword_2_and)
txt_kktix_area_keyword_2_and_value = StringVar(frame_group_kktix, value=config_dict["kktix"]["area_keyword_2_and"].strip())
txt_kktix_area_keyword_2_and = Entry(frame_group_kktix, width=20, textvariable = txt_kktix_area_keyword_2_and_value)
txt_kktix_area_keyword_2_and.grid(column=1, row=group_row_count, sticky = W)
@ -1822,7 +1823,7 @@ def PreferenctTab(root, config_dict, language_code, UI_PADDING_X):
lbl_area_keyword_1.grid(column=0, row=area_keyword_1_index, sticky = E)
global txt_area_keyword_1
txt_area_keyword_1_value = StringVar(frame_group_tixcraft, value=area_keyword_1)
txt_area_keyword_1_value = StringVar(frame_group_tixcraft, value=config_dict["tixcraft"]["area_auto_select"]["area_keyword_1"].strip())
txt_area_keyword_1 = Entry(frame_group_tixcraft, width=20, textvariable = txt_area_keyword_1_value)
txt_area_keyword_1.grid(column=1, row=area_keyword_1_index, sticky = W)
@ -1836,7 +1837,7 @@ def PreferenctTab(root, config_dict, language_code, UI_PADDING_X):
lbl_area_keyword_2.grid(column=0, row=area_keyword_2_index, sticky = E)
global txt_area_keyword_2
txt_area_keyword_2_value = StringVar(frame_group_tixcraft, value=area_keyword_2)
txt_area_keyword_2_value = StringVar(frame_group_tixcraft, value=config_dict["tixcraft"]["area_auto_select"]["area_keyword_2"].strip())
txt_area_keyword_2 = Entry(frame_group_tixcraft, width=20, textvariable = txt_area_keyword_2_value)
txt_area_keyword_2.grid(column=1, row=area_keyword_2_index, sticky = W)
@ -1858,7 +1859,7 @@ def PreferenctTab(root, config_dict, language_code, UI_PADDING_X):
lbl_area_keyword_3.grid(column=0, row=area_keyword_3_index, sticky = E)
global txt_area_keyword_3
txt_area_keyword_3_value = StringVar(frame_group_tixcraft, value=area_keyword_3)
txt_area_keyword_3_value = StringVar(frame_group_tixcraft, value=config_dict["tixcraft"]["area_auto_select"]["area_keyword_3"].strip())
txt_area_keyword_3 = Entry(frame_group_tixcraft, width=20, textvariable = txt_area_keyword_3_value)
txt_area_keyword_3.grid(column=1, row=area_keyword_3_index, sticky = W)
@ -1880,7 +1881,7 @@ def PreferenctTab(root, config_dict, language_code, UI_PADDING_X):
lbl_area_keyword_4.grid(column=0, row=area_keyword_4_index, sticky = E)
global txt_area_keyword_4
txt_area_keyword_4_value = StringVar(frame_group_tixcraft, value=area_keyword_4)
txt_area_keyword_4_value = StringVar(frame_group_tixcraft, value=config_dict["tixcraft"]["area_auto_select"]["area_keyword_4"].strip())
txt_area_keyword_4 = Entry(frame_group_tixcraft, width=20, textvariable = txt_area_keyword_4_value)
txt_area_keyword_4.grid(column=1, row=area_keyword_4_index, sticky = W)
@ -1894,6 +1895,17 @@ def PreferenctTab(root, config_dict, language_code, UI_PADDING_X):
group_row_count+=1
global lbl_area_keyword_exclude
lbl_area_keyword_exclude = Label(frame_group_tixcraft, text=translate[language_code]['area_keyword_exclude'])
lbl_area_keyword_exclude.grid(column=0, row=group_row_count, sticky = E)
global txt_area_keyword_exclude
txt_area_keyword_exclude_value = StringVar(frame_group_tixcraft, value=config_dict["tixcraft"]["area_auto_select"]["area_keyword_exclude"].strip())
txt_area_keyword_exclude = Entry(frame_group_tixcraft, width=20, textvariable = txt_area_keyword_exclude_value)
txt_area_keyword_exclude.grid(column=1, row=group_row_count, sticky = W)
group_row_count+=1
global lbl_presale_code
lbl_presale_code = Label(frame_group_tixcraft, text=translate[language_code]['user_guess_string'])
lbl_presale_code.grid(column=0, row=group_row_count, sticky = E)
@ -1914,37 +1926,6 @@ def PreferenctTab(root, config_dict, language_code, UI_PADDING_X):
txt_presale_code_delimiter = Entry(frame_group_tixcraft, width=20, textvariable = txt_presale_code_delemiter_value)
txt_presale_code_delimiter.grid(column=1, row=group_row_count, sticky = W)
group_row_count+=1
global lbl_ocr_captcha
lbl_ocr_captcha = Label(frame_group_tixcraft, text=translate[language_code]['ocr_captcha'])
lbl_ocr_captcha.grid(column=0, row=group_row_count, sticky = E)
global chk_state_ocr_captcha
chk_state_ocr_captcha = BooleanVar()
chk_state_ocr_captcha.set(config_dict['ocr_captcha']["enable"])
global chk_ocr_captcha
chk_ocr_captcha = Checkbutton(frame_group_tixcraft, text=translate[language_code]['enable'], variable=chk_state_ocr_captcha, command=showHideOcrCaptchaWithSubmit)
chk_ocr_captcha.grid(column=1, row=group_row_count, sticky = W)
group_row_count+=1
global ocr_captcha_force_submit_index
ocr_captcha_force_submit_index = group_row_count
global lbl_ocr_captcha_force_submit
lbl_ocr_captcha_force_submit = Label(frame_group_tixcraft, text=translate[language_code]['ocr_captcha_force_submit'])
lbl_ocr_captcha_force_submit.grid(column=0, row=ocr_captcha_force_submit_index, sticky = E)
global chk_state_ocr_captcha_force_submit
chk_state_ocr_captcha_force_submit = BooleanVar()
chk_state_ocr_captcha_force_submit.set(config_dict['ocr_captcha']["force_submit"])
global chk_ocr_captcha_force_submit
chk_ocr_captcha_force_submit = Checkbutton(frame_group_tixcraft, text=translate[language_code]['enable'], variable=chk_state_ocr_captcha_force_submit)
chk_ocr_captcha_force_submit.grid(column=1, row=group_row_count, sticky = W)
# final flush.
global frame_group_tixcraft_index
frame_group_tixcraft_index = row_count
@ -2139,8 +2120,42 @@ def AdvancedTab(root, config_dict, language_code, UI_PADDING_X):
chk_verbose = Checkbutton(frame_group_header, text=translate[language_code]['enable'], variable=chk_state_verbose)
chk_verbose.grid(column=1, row=group_row_count, sticky = W)
group_row_count+=1
global lbl_ocr_captcha
lbl_ocr_captcha = Label(frame_group_header, text=translate[language_code]['ocr_captcha'])
lbl_ocr_captcha.grid(column=0, row=group_row_count, sticky = E)
global chk_state_ocr_captcha
chk_state_ocr_captcha = BooleanVar()
chk_state_ocr_captcha.set(config_dict['ocr_captcha']["enable"])
global chk_ocr_captcha
chk_ocr_captcha = Checkbutton(frame_group_header, text=translate[language_code]['enable'], variable=chk_state_ocr_captcha, command=showHideOcrCaptchaWithSubmit)
chk_ocr_captcha.grid(column=1, row=group_row_count, sticky = W)
group_row_count+=1
global ocr_captcha_force_submit_index
ocr_captcha_force_submit_index = group_row_count
global lbl_ocr_captcha_force_submit
lbl_ocr_captcha_force_submit = Label(frame_group_header, text=translate[language_code]['ocr_captcha_force_submit'])
lbl_ocr_captcha_force_submit.grid(column=0, row=ocr_captcha_force_submit_index, sticky = E)
global chk_state_ocr_captcha_force_submit
chk_state_ocr_captcha_force_submit = BooleanVar()
chk_state_ocr_captcha_force_submit.set(config_dict['ocr_captcha']["force_submit"])
global chk_ocr_captcha_force_submit
chk_ocr_captcha_force_submit = Checkbutton(frame_group_header, text=translate[language_code]['enable'], variable=chk_state_ocr_captcha_force_submit)
chk_ocr_captcha_force_submit.grid(column=1, row=group_row_count, sticky = W)
frame_group_header.grid(column=0, row=row_count, padx=UI_PADDING_X)
showHideOcrCaptchaWithSubmit()
def AutofillTab(root, config_dict, language_code, UI_PADDING_X):
row_count = 0
@ -2576,7 +2591,7 @@ def main():
load_GUI(root, config_dict)
GUI_SIZE_WIDTH = 510
GUI_SIZE_HEIGHT = 619
GUI_SIZE_HEIGHT = 600
GUI_SIZE_MACOS = str(GUI_SIZE_WIDTH) + 'x' + str(GUI_SIZE_HEIGHT)
GUI_SIZE_WINDOWS=str(GUI_SIZE_WIDTH-60) + 'x' + str(GUI_SIZE_HEIGHT-55)