diff --git a/chrome_tixcraft.py b/chrome_tixcraft.py index c47be81..1610801 100644 --- a/chrome_tixcraft.py +++ b/chrome_tixcraft.py @@ -44,7 +44,7 @@ except Exception as exc: print(exc) pass -CONST_APP_VERSION = "MaxBot (2024.04.04)" +CONST_APP_VERSION = "MaxBot (2024.04.05)" CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt" CONST_MAXBOT_CONFIG_FILE = "settings.json" diff --git a/config_launcher.py b/config_launcher.py index a16d8fc..b1c07aa 100644 --- a/config_launcher.py +++ b/config_launcher.py @@ -24,7 +24,7 @@ import webbrowser import util -CONST_APP_VERSION = "MaxBot (2024.04.04)" +CONST_APP_VERSION = "MaxBot (2024.04.05)" CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json" CONST_MAXBOT_CONFIG_FILE = "settings.json" diff --git a/kktix_status.py b/kktix_status.py index 0d9d6d8..c3247c5 100644 --- a/kktix_status.py +++ b/kktix_status.py @@ -29,7 +29,7 @@ from datetime import datetime import util -CONST_APP_VERSION = "MaxBot (2024.04.04)" +CONST_APP_VERSION = "MaxBot (2024.04.05)" CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_KKTIX_CONFIG_FILE = "kktix.json" diff --git a/nodriver_tixcraft.py b/nodriver_tixcraft.py index 1c36077..bf90eb7 100644 --- a/nodriver_tixcraft.py +++ b/nodriver_tixcraft.py @@ -33,7 +33,7 @@ except Exception as exc: print(exc) pass -CONST_APP_VERSION = "MaxBot (2024.04.04)" +CONST_APP_VERSION = "MaxBot (2024.04.05)" CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt" CONST_MAXBOT_CONFIG_FILE = "settings.json" @@ -596,29 +596,26 @@ async def nodriver_kktix_assign_ticket_number(tab, config_dict, kktix_area_keywo if not target_area is None: current_ticket_number = "" if show_debug_message: - print("try to get input box value.") + print("try to set input box value.") try: - current_ticket_number = str(target_area.attribute('value')).strip() + current_ticket_number = await target_area.apply('function (element) { return element.value; } ') except Exception as exc: pass + if show_debug_message: + print("current_ticket_number", current_ticket_number) + if len(current_ticket_number) > 0: if current_ticket_number == "0": try: print("asssign ticket number:%s" % ticket_number_str) - target_area.clear_input() - target_area.send_keys(ticket_number_str) + await target_area.click() + await target_area.apply('function (element) {element.value = ""; } ') + await target_area.send_keys(ticket_number_str); is_ticket_number_assigned = True except Exception as exc: print("asssign ticket number to ticket-price field Exception:") print(exc) - try: - target_area.clear() - target_area.send_keys("1") - is_ticket_number_assigned = True - except Exception as exc2: - print("asssign ticket number to ticket-price still failed.") - pass else: if show_debug_message: print("value already assigned.") @@ -1618,6 +1615,7 @@ async def nodriver_cityline_auto_retry_access(tab, url, config_dict): cityline_event_url = "https://event.cityline.com/" if "?loc=" in url: + url = url.replace("%3Flang%3DTW%26lang%3DTW","%3Flang%3DTW") loc = url.split("?loc=")[1] if len(loc) > 0: if "&" in loc: @@ -1630,11 +1628,14 @@ async def nodriver_cityline_auto_retry_access(tab, url, config_dict): new_url = cityline_event_url + loc_decode if not "&lang=" in new_url: new_url = new_url + "&lang=TW" + new_url = new_url.replace("lang=TW&lang=TW","lang=TW") if new_url != url: try: + #print("old url:", url) print("redirect to url:", new_url) tab = await tab.get(new_url) time.sleep(0.2) + pass except Exception as e: print(e) pass @@ -1646,6 +1647,7 @@ async def nodriver_cityline_auto_retry_access(tab, url, config_dict): new_url = url_array[0] + "lang=TW" if new_url != url: try: + new_url = new_url.replace("lang=TW&lang=TW","lang=TW") print("redirect to url:", new_url) tab = await tab.get(new_url) time.sleep(0.2) @@ -1834,6 +1836,11 @@ async def nodriver_cityline_close_second_tab(tab, url): return new_tab async def nodriver_cityline_main(tab, url, config_dict): + global cityline_dict + if not 'cityline_dict' in globals(): + cityline_dict = {} + cityline_dict["played_sound_ticket"] = False + if 'msg.cityline.com' in url or 'event.cityline.com' in url: await nodriver_cityline_auto_retry_access(tab, url, config_dict) @@ -1865,7 +1872,13 @@ async def nodriver_cityline_main(tab, url, config_dict): # area page: # TODO: #https://venue.cityline.com/utsvInternet/EVENT_NAME/performance?event=EVENT_CODE&perfId=PROFORMANCE_ID - pass + if 'venue.cityline.com' in url and '/performance?': + if config_dict["advanced"]["play_sound"]["ticket"]: + if not cityline_dict["played_sound_ticket"]: + play_sound_while_ordering(config_dict) + cityline_dict["played_sound_ticket"] = True + else: + cityline_dict["played_sound_ticket"] = False return tab diff --git a/settings.py b/settings.py index a5765ae..ca1c781 100644 --- a/settings.py +++ b/settings.py @@ -41,7 +41,7 @@ try: except Exception as exc: pass -CONST_APP_VERSION = "MaxBot (2024.04.04)" +CONST_APP_VERSION = "MaxBot (2024.04.05)" CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt" CONST_MAXBOT_CONFIG_FILE = "settings.json" diff --git a/webdriver/Maxbotplus_1.0.0/js/cityline_msg_front.js b/webdriver/Maxbotplus_1.0.0/js/cityline_msg_front.js index 5ec39a7..eebd958 100644 --- a/webdriver/Maxbotplus_1.0.0/js/cityline_msg_front.js +++ b/webdriver/Maxbotplus_1.0.0/js/cityline_msg_front.js @@ -16,7 +16,7 @@ function begin() // too short to cause error. if(auto_reload_page_interval < 0.05) { - auto_reload_page_interval = 0.1; + auto_reload_page_interval = 0.2; } if(status=='ON') { @@ -36,11 +36,15 @@ function begin() $(".btn_cta").prop('disabled', false); //$(".btn_cta").prop('disabled', false).trigger("click"); if (typeof goEvent !== "undefined") { - if(location.href.indexOf('home?') > -1 - || location.href.indexOf('lang=') > -1 - || location.href.indexOf('?loc=') > -1) { + let is_need_goEvent = false; + if(location.href.indexOf('home?') > -1) is_need_goEvent = true; + if(location.href.indexOf('?loc=') > -1) is_need_goEvent = true; + if(location.href.indexOf('lang=') > -1) is_need_goEvent = true; + if(is_need_goEvent) { goEvent(); } + } else { + $("#btn-retry-en-1").prop('disabled', false).trigger("click"); } }, target_interval); } @@ -108,11 +112,12 @@ function getHtmlDocName() { if(getHtmlDocName()==null) { history.back(); } -if (typeof goEvent !== "undefined") { - if(location.href.indexOf('home?') > -1 - || location.href.indexOf('lang=') > -1) { - //goEvent(); - } else { +if (typeof goEvent !== "undefined") { + let is_need_back = true; + if(location.href.indexOf('home?') > -1) is_need_back = false; + if(location.href.indexOf('?loc=') > -1) is_need_back = false; + if(location.href.indexOf('lang=') > -1) is_need_back = false; + if (is_need_back) { history.back(); } } diff --git a/webdriver/Maxbotplus_1.0.0/manifest.json b/webdriver/Maxbotplus_1.0.0/manifest.json index ac5d90f..40f3076 100644 --- a/webdriver/Maxbotplus_1.0.0/manifest.json +++ b/webdriver/Maxbotplus_1.0.0/manifest.json @@ -434,5 +434,5 @@ ] } ], - "version": "1.0.23" + "version": "1.0.24" } \ No newline at end of file