2023-05-28, ibon play sound, after input captcha answer.
parent
0a52fdd343
commit
4acc72b0b7
|
@ -54,7 +54,7 @@ import itertools
|
||||||
import ssl
|
import ssl
|
||||||
ssl._create_default_https_context = ssl._create_unverified_context
|
ssl._create_default_https_context = ssl._create_unverified_context
|
||||||
|
|
||||||
CONST_APP_VERSION = u"MaxBot (2023.05.27)"
|
CONST_APP_VERSION = u"MaxBot (2023.05.28)"
|
||||||
|
|
||||||
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
||||||
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
|
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
|
||||||
|
@ -2647,7 +2647,7 @@ def tixcraft_ticket_main(driver, config_dict, ocr, Captcha_Browser, domain_name)
|
||||||
|
|
||||||
# must wait select object ready to assign ticket number.
|
# must wait select object ready to assign ticket number.
|
||||||
if not is_ticket_number_assigned:
|
if not is_ticket_number_assigned:
|
||||||
# only this case: "ticket number changed by bot" to play sound!
|
# only this case: "ticket number not changed by bot" to play sound!
|
||||||
# PS: I assume each time assign ticket number will succufully changed, so let sound play first.
|
# PS: I assume each time assign ticket number will succufully changed, so let sound play first.
|
||||||
check_and_play_sound_for_captcha(config_dict)
|
check_and_play_sound_for_captcha(config_dict)
|
||||||
|
|
||||||
|
@ -3786,6 +3786,7 @@ def kktix_reg_captcha(driver, config_dict, answer_index, is_finish_checkbox_clic
|
||||||
if len(inputed_captcha_text) == 0:
|
if len(inputed_captcha_text) == 0:
|
||||||
try:
|
try:
|
||||||
#print("focus() captcha to input.")
|
#print("focus() captcha to input.")
|
||||||
|
# only this case: "ticket number not changed by bot" to play sound!
|
||||||
check_and_play_sound_for_captcha(config_dict)
|
check_and_play_sound_for_captcha(config_dict)
|
||||||
captcha_password_input_tag.click()
|
captcha_password_input_tag.click()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
@ -6352,13 +6353,10 @@ def hkticketing_login(driver, account, password):
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def check_and_play_sound_for_captcha(config_dict):
|
def check_and_play_sound_for_captcha(config_dict):
|
||||||
play_captcha_sound = config_dict["advanced"]["play_captcha_sound"]["enable"]
|
if config_dict["advanced"]["play_captcha_sound"]["enable"]:
|
||||||
captcha_sound_filename = config_dict["advanced"]["play_captcha_sound"]["filename"].strip()
|
|
||||||
if play_captcha_sound:
|
|
||||||
app_root = get_app_root()
|
app_root = get_app_root()
|
||||||
captcha_sound_filename = os.path.join(app_root, captcha_sound_filename)
|
captcha_sound_filename = os.path.join(app_root, config_dict["advanced"]["play_captcha_sound"]["filename"].strip())
|
||||||
play_mp3_async(captcha_sound_filename)
|
play_mp3_async(captcha_sound_filename)
|
||||||
|
|
||||||
def play_mp3_async(sound_filename):
|
def play_mp3_async(sound_filename):
|
||||||
|
@ -7039,6 +7037,12 @@ def urbtix_main(driver, url, config_dict):
|
||||||
if len(urbtix_account) > 2:
|
if len(urbtix_account) > 2:
|
||||||
urbtix_login(driver, urbtix_account, decryptMe(config_dict["advanced"]["urbtix_password"]))
|
urbtix_login(driver, urbtix_account, decryptMe(config_dict["advanced"]["urbtix_password"]))
|
||||||
|
|
||||||
|
is_ready_to_buy_from_queue = False
|
||||||
|
# Q: How to know ready to buy ticket from queue?
|
||||||
|
if is_ready_to_buy_from_queue:
|
||||||
|
# play sound when ready to buy ticket.
|
||||||
|
check_and_play_sound_for_captcha(config_dict)
|
||||||
|
|
||||||
# https://www.urbtix.hk/event-detail/00000/
|
# https://www.urbtix.hk/event-detail/00000/
|
||||||
if '/event-detail/' in url:
|
if '/event-detail/' in url:
|
||||||
if config_dict["tixcraft"]["date_auto_select"]["enable"]:
|
if config_dict["tixcraft"]["date_auto_select"]["enable"]:
|
||||||
|
@ -7151,6 +7155,12 @@ def cityline_main(driver, url, config_dict):
|
||||||
except Exception as excSwithFail:
|
except Exception as excSwithFail:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
is_ready_to_buy_from_queue = False
|
||||||
|
# Q: How to know ready to buy ticket from queue?
|
||||||
|
if is_ready_to_buy_from_queue:
|
||||||
|
# play sound when ready to buy ticket.
|
||||||
|
check_and_play_sound_for_captcha(config_dict)
|
||||||
|
|
||||||
if '/eventDetail?' in url:
|
if '/eventDetail?' in url:
|
||||||
is_modal_dialog_popup = check_modal_dialog_popup(driver)
|
is_modal_dialog_popup = check_modal_dialog_popup(driver)
|
||||||
if is_modal_dialog_popup:
|
if is_modal_dialog_popup:
|
||||||
|
@ -7355,7 +7365,6 @@ def ibon_ticket_agree(driver):
|
||||||
def ibon_check_sold_out(driver):
|
def ibon_check_sold_out(driver):
|
||||||
is_sold_out = False
|
is_sold_out = False
|
||||||
|
|
||||||
# check agree
|
|
||||||
div_ticket_info = None
|
div_ticket_info = None
|
||||||
try:
|
try:
|
||||||
div_ticket_info = driver.find_element(By.CSS_SELECTOR, '#ticket-info')
|
div_ticket_info = driver.find_element(By.CSS_SELECTOR, '#ticket-info')
|
||||||
|
@ -7553,6 +7562,7 @@ def ibon_captcha(driver, config_dict, ocr, Captcha_Browser, model_name):
|
||||||
is_need_redo_ocr, previous_answer, is_form_sumbited = ibon_auto_ocr(driver, config_dict, ocr, away_from_keyboard_enable, previous_answer, Captcha_Browser, ocr_captcha_image_source, model_name)
|
is_need_redo_ocr, previous_answer, is_form_sumbited = ibon_auto_ocr(driver, config_dict, ocr, away_from_keyboard_enable, previous_answer, Captcha_Browser, ocr_captcha_image_source, model_name)
|
||||||
|
|
||||||
# TODO: must ensure the answer is corrent...
|
# TODO: must ensure the answer is corrent...
|
||||||
|
if not is_need_redo_ocr:
|
||||||
is_cpatcha_sent = True
|
is_cpatcha_sent = True
|
||||||
|
|
||||||
if is_form_sumbited:
|
if is_form_sumbited:
|
||||||
|
@ -7636,6 +7646,8 @@ def ibon_main(driver, url, config_dict, ibon_dict, ocr, Captcha_Browser):
|
||||||
is_finish_checkbox_click = ibon_uncheck_adjacent_seat(driver, config_dict)
|
is_finish_checkbox_click = ibon_uncheck_adjacent_seat(driver, config_dict)
|
||||||
|
|
||||||
# captcha
|
# captcha
|
||||||
|
is_cpatcha_sent = False
|
||||||
|
if config_dict["ocr_captcha"]["enable"]:
|
||||||
domain_name = url.split('/')[2]
|
domain_name = url.split('/')[2]
|
||||||
model_name = url.split('/')[5]
|
model_name = url.split('/')[5]
|
||||||
if len(model_name) > 7:
|
if len(model_name) > 7:
|
||||||
|
@ -7647,11 +7659,16 @@ def ibon_main(driver, url, config_dict, ibon_dict, ocr, Captcha_Browser):
|
||||||
|
|
||||||
is_cpatcha_sent = ibon_captcha(driver, config_dict, ocr, Captcha_Browser, model_name)
|
is_cpatcha_sent = ibon_captcha(driver, config_dict, ocr, Captcha_Browser, model_name)
|
||||||
|
|
||||||
# step 2: assign ticket number.
|
# assign ticket number.
|
||||||
is_match_target_feature = True
|
is_match_target_feature = True
|
||||||
is_ticket_number_assigned = ibon_ticket_number_auto_select(driver, config_dict)
|
is_ticket_number_assigned = ibon_ticket_number_auto_select(driver, config_dict)
|
||||||
if is_ticket_number_assigned:
|
if is_ticket_number_assigned:
|
||||||
click_ret = ibon_purchase_button_press(driver)
|
click_ret = ibon_purchase_button_press(driver)
|
||||||
|
|
||||||
|
if click_ret:
|
||||||
|
# only this case: "ticket number CHANGED by bot" and "cpatcha sent" to play sound!
|
||||||
|
if is_cpatcha_sent:
|
||||||
|
check_and_play_sound_for_captcha(config_dict)
|
||||||
else:
|
else:
|
||||||
is_sold_out = ibon_check_sold_out(driver)
|
is_sold_out = ibon_check_sold_out(driver)
|
||||||
if is_sold_out:
|
if is_sold_out:
|
||||||
|
@ -8499,6 +8516,12 @@ def hkticketing_main(driver, url, config_dict, hkticketing_dict):
|
||||||
if len(account) > 4:
|
if len(account) > 4:
|
||||||
hkticketing_login(driver, account, decryptMe(config_dict["advanced"]["hkticketing_password"]))
|
hkticketing_login(driver, account, decryptMe(config_dict["advanced"]["hkticketing_password"]))
|
||||||
|
|
||||||
|
is_ready_to_buy_from_queue = False
|
||||||
|
# Q: How to know ready to buy ticket from queue?
|
||||||
|
if is_ready_to_buy_from_queue:
|
||||||
|
# play sound when ready to buy ticket.
|
||||||
|
check_and_play_sound_for_captcha(config_dict)
|
||||||
|
|
||||||
#https://premier.hkticketing.com/shows/show.aspx?sh=XXXX
|
#https://premier.hkticketing.com/shows/show.aspx?sh=XXXX
|
||||||
if 'shows/show.aspx?' in url:
|
if 'shows/show.aspx?' in url:
|
||||||
is_modal_dialog_popup = check_modal_dialog_popup(driver)
|
is_modal_dialog_popup = check_modal_dialog_popup(driver)
|
||||||
|
@ -9995,11 +10018,12 @@ function svgUrlToPng(svgUrl, callback) {
|
||||||
svgImage.src = svgUrl;
|
svgImage.src = svgUrl;
|
||||||
}
|
}
|
||||||
const img=document.querySelector('%s');
|
const img=document.querySelector('%s');
|
||||||
|
if(img!=null) {
|
||||||
const svg=img.innerHTML;
|
const svg=img.innerHTML;
|
||||||
svgToPng(svg, (imgData) => {
|
svgToPng(svg, (imgData) => {
|
||||||
callback = arguments[arguments.length - 1];
|
callback = arguments[arguments.length - 1];
|
||||||
callback(imgData);
|
callback(imgData);
|
||||||
});
|
}); }
|
||||||
""" % (image_id))
|
""" % (image_id))
|
||||||
if not form_verifyCode_base64 is None:
|
if not form_verifyCode_base64 is None:
|
||||||
img_base64 = base64.b64decode(form_verifyCode_base64.split(',')[1])
|
img_base64 = base64.b64decode(form_verifyCode_base64.split(',')[1])
|
||||||
|
|
|
@ -22,7 +22,7 @@ import base64
|
||||||
import threading
|
import threading
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
CONST_APP_VERSION = u"MaxBot (2023.05.27)"
|
CONST_APP_VERSION = u"MaxBot (2023.05.28)"
|
||||||
|
|
||||||
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"
|
||||||
|
|
|
@ -25,7 +25,7 @@ import threading
|
||||||
import subprocess
|
import subprocess
|
||||||
import json
|
import json
|
||||||
|
|
||||||
CONST_APP_VERSION = u"MaxBot (2023.05.27)"
|
CONST_APP_VERSION = u"MaxBot (2023.05.28)"
|
||||||
|
|
||||||
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
||||||
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
|
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
|
||||||
|
|
Loading…
Reference in New Issue