2023-10-16, change play sound title to play sound while ordering

master
CHUN YU YAO 2023-10-30 08:15:20 +08:00
parent a620c1f0e0
commit 5739fda212
5 changed files with 54 additions and 45 deletions

View File

@ -1,9 +1,11 @@
import requests
import json
import base64 import base64
from PIL import Image import json
from io import BytesIO from io import BytesIO
import requests
from PIL import Image
class NonBrowser(): class NonBrowser():
def __init__(self, domain_name = "tixcraft.com") -> None: def __init__(self, domain_name = "tixcraft.com") -> None:
self.Session = requests.session() self.Session = requests.session()

View File

@ -55,7 +55,7 @@ import webbrowser
import chromedriver_autoinstaller import chromedriver_autoinstaller
CONST_APP_VERSION = "MaxBot (2023.10.15)" CONST_APP_VERSION = "MaxBot (2023.10.16)"
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"
@ -3301,7 +3301,7 @@ def tixcraft_ticket_main(driver, config_dict, ocr, Captcha_Browser, domain_name)
if not is_ticket_number_assigned: if not is_ticket_number_assigned:
# only this case: "ticket number not 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) play_sound_while_ordering(config_dict)
ticket_number = str(config_dict["ticket_number"]) ticket_number = str(config_dict["ticket_number"])
is_ticket_number_assigned = tixcraft_ticket_number_auto_fill(driver, select_obj, ticket_number) is_ticket_number_assigned = tixcraft_ticket_number_auto_fill(driver, select_obj, ticket_number)
@ -4431,7 +4431,7 @@ def kktix_reg_captcha(driver, config_dict, fail_list, captcha_sound_played, is_f
if not captcha_sound_played: if not captcha_sound_played:
captcha_sound_played = True captcha_sound_played = True
try: try:
check_and_play_sound_for_captcha(config_dict) play_sound_while_ordering(config_dict)
except Exception as exc: except Exception as exc:
pass pass
@ -6865,7 +6865,7 @@ def hkticketing_login(driver, account, password):
return ret return ret
def check_and_play_sound_for_captcha(config_dict): def play_sound_while_ordering(config_dict):
if config_dict["advanced"]["play_captcha_sound"]["enable"]: if config_dict["advanced"]["play_captcha_sound"]["enable"]:
app_root = get_app_root() app_root = get_app_root()
captcha_sound_filename = os.path.join(app_root, config_dict["advanced"]["play_captcha_sound"]["filename"].strip()) captcha_sound_filename = os.path.join(app_root, config_dict["advanced"]["play_captcha_sound"]["filename"].strip())
@ -7683,7 +7683,7 @@ def urbtix_main(driver, url, config_dict):
# Q: How to know ready to buy ticket from queue? # Q: How to know ready to buy ticket from queue?
if is_ready_to_buy_from_queue: if is_ready_to_buy_from_queue:
# play sound when ready to buy ticket. # play sound when ready to buy ticket.
check_and_play_sound_for_captcha(config_dict) play_sound_while_ordering(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:
@ -7845,7 +7845,7 @@ def cityline_main(driver, url, config_dict):
# Q: How to know ready to buy ticket from queue? # Q: How to know ready to buy ticket from queue?
if is_ready_to_buy_from_queue: if is_ready_to_buy_from_queue:
# play sound when ready to buy ticket. # play sound when ready to buy ticket.
check_and_play_sound_for_captcha(config_dict) play_sound_while_ordering(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)
@ -8301,7 +8301,7 @@ def ibon_main(driver, url, config_dict, ibon_dict, ocr, Captcha_Browser):
# only this case: "ticket number CHANGED by bot" and "cpatcha sent" to play sound! # only this case: "ticket number CHANGED by bot" and "cpatcha sent" to play sound!
if click_ret: if click_ret:
check_and_play_sound_for_captcha(config_dict) play_sound_while_ordering(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:
@ -9370,7 +9370,7 @@ def softix_powerweb_main(driver, url, config_dict, hkticketing_dict):
# TODO: play sound when ready to buy ticket. # TODO: play sound when ready to buy ticket.
# Q: How to know ready to buy ticket from queue? # Q: How to know ready to buy ticket from queue?
if is_ready_to_buy_from_queue: if is_ready_to_buy_from_queue:
check_and_play_sound_for_captcha(config_dict) play_sound_while_ordering(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:
@ -11545,14 +11545,21 @@ def ticketplus_main(driver, url, config_dict, ocr, Captcha_Browser, ticketplus_d
is_captcha_sent, ticketplus_dict = ticketplus_order(driver, config_dict, ocr, Captcha_Browser, ticketplus_dict) is_captcha_sent, ticketplus_dict = ticketplus_order(driver, config_dict, ocr, Captcha_Browser, ticketplus_dict)
#https://ticketplus.com.tw/confirm/xx/oo #https://ticketplus.com.tw/confirm/xx/oo
if '/confirm/' in url.lower(): if '/confirm/' in url.lower() or '/confirmseat/' in url.lower():
is_event_page = False is_event_page = False
if len(url.split('/'))==6: if len(url.split('/'))==6:
is_event_page = True is_event_page = True
if is_event_page: if is_event_page:
check_and_play_sound_for_captcha(config_dict) print("is_popup_confirm",ticketplus_dict["is_popup_confirm"])
if not ticketplus_dict["is_popup_confirm"]:
ticketplus_dict["is_popup_confirm"] = True
play_sound_while_ordering(config_dict)
ticketplus_confirm(driver, config_dict) ticketplus_confirm(driver, config_dict)
else:
ticketplus_dict["is_popup_confirm"] = False
else:
ticketplus_dict["is_popup_confirm"] = False
return ticketplus_dict return ticketplus_dict
@ -11685,6 +11692,7 @@ def main(args):
ticketplus_dict = {} ticketplus_dict = {}
ticketplus_dict["fail_list"]=[] ticketplus_dict["fail_list"]=[]
ticketplus_dict["is_popup_confirm"] = False
ocr = None ocr = None
Captcha_Browser = None Captcha_Browser = None

View File

@ -3,9 +3,9 @@
try: try:
# for Python2 # for Python2
from Tkinter import *
import ttk
import tkMessageBox as messagebox import tkMessageBox as messagebox
import ttk
from Tkinter import *
except ImportError: except ImportError:
# for Python3 # for Python3
from tkinter import * from tkinter import *
@ -13,16 +13,16 @@ except ImportError:
from tkinter import messagebox from tkinter import messagebox
from tkinter import filedialog from tkinter import filedialog
import os
import sys
import platform
import json
import webbrowser
import base64 import base64
import threading import json
import os
import platform
import subprocess import subprocess
import sys
import threading
import webbrowser
CONST_APP_VERSION = "MaxBot (2023.10.15)" CONST_APP_VERSION = "MaxBot (2023.10.16)"
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

@ -34,7 +34,7 @@ import ssl
ssl._create_default_https_context = ssl._create_unverified_context ssl._create_default_https_context = ssl._create_unverified_context
CONST_APP_VERSION = "MaxBot (2023.10.15)" CONST_APP_VERSION = "MaxBot (2023.10.16)"
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"
@ -202,8 +202,8 @@ def load_translate():
en_us["ticketplus_password"] = 'TicketPlus password' en_us["ticketplus_password"] = 'TicketPlus password'
en_us["save_password_alert"] = 'Saving passwords to config file may expose your passwords.' en_us["save_password_alert"] = 'Saving passwords to config file may expose your passwords.'
en_us["play_captcha_sound"] = 'Play sound when captcha' en_us["play_captcha_sound"] = 'Play sound while ordering'
en_us["captcha_sound_filename"] = 'captcha sound filename' en_us["captcha_sound_filename"] = 'sound filename'
en_us["adblock_plus_enable"] = 'Browser Extension' en_us["adblock_plus_enable"] = 'Browser Extension'
en_us["adblock_plus_settings"] = "Adblock Advanced Filter" en_us["adblock_plus_settings"] = "Adblock Advanced Filter"
en_us["disable_adjacent_seat"] = "Disable Adjacent Seat" en_us["disable_adjacent_seat"] = "Disable Adjacent Seat"
@ -302,8 +302,8 @@ def load_translate():
zh_tw["ticketplus_password"] = '遠大 密碼' zh_tw["ticketplus_password"] = '遠大 密碼'
zh_tw["save_password_alert"] = '將密碼保存到設定檔中可能會讓您的密碼被盜。' zh_tw["save_password_alert"] = '將密碼保存到設定檔中可能會讓您的密碼被盜。'
zh_tw["play_captcha_sound"] = '輸入驗證碼時播放音效' zh_tw["play_captcha_sound"] = '訂購時播放音效'
zh_tw["captcha_sound_filename"] = '驗證碼用音效檔' zh_tw["captcha_sound_filename"] = '音效檔'
zh_tw["adblock_plus_enable"] = '瀏覽器擴充功能' zh_tw["adblock_plus_enable"] = '瀏覽器擴充功能'
zh_tw["adblock_plus_settings"] = "Adblock 進階過濾規則" zh_tw["adblock_plus_settings"] = "Adblock 進階過濾規則"
zh_tw["disable_adjacent_seat"] = "允許不連續座位" zh_tw["disable_adjacent_seat"] = "允許不連續座位"
@ -403,8 +403,8 @@ def load_translate():
zh_cn["ticketplus_password"] = '远大 密码' zh_cn["ticketplus_password"] = '远大 密码'
zh_cn["save_password_alert"] = '将密码保存到文件中可能会暴露您的密码。' zh_cn["save_password_alert"] = '将密码保存到文件中可能会暴露您的密码。'
zh_cn["play_captcha_sound"] = '输入验证码时播放音效' zh_cn["play_captcha_sound"] = '订购时播放音效'
zh_cn["captcha_sound_filename"] = '验证码用音效档' zh_cn["captcha_sound_filename"] = '音效档'
zh_cn["adblock_plus_enable"] = '浏览器扩充功能' zh_cn["adblock_plus_enable"] = '浏览器扩充功能'
zh_cn["adblock_plus_settings"] = "Adblock 进阶过滤规则" zh_cn["adblock_plus_settings"] = "Adblock 进阶过滤规则"
zh_cn["disable_adjacent_seat"] = "允许不连续座位" zh_cn["disable_adjacent_seat"] = "允许不连续座位"
@ -503,8 +503,8 @@ def load_translate():
ja_jp["ticketplus_password"] = '遠大のパスワード' ja_jp["ticketplus_password"] = '遠大のパスワード'
ja_jp["save_password_alert"] = 'パスワードをファイルに保存すると、パスワードが公開される可能性があります。' ja_jp["save_password_alert"] = 'パスワードをファイルに保存すると、パスワードが公開される可能性があります。'
ja_jp["play_captcha_sound"] = 'キャプチャ時に音を鳴らす' ja_jp["play_captcha_sound"] = '注文時に音を鳴らす'
ja_jp["captcha_sound_filename"] = 'サウンドファイル' ja_jp["captcha_sound_filename"] = 'サウンドファイル'
ja_jp["adblock_plus_enable"] = '拡張機能' ja_jp["adblock_plus_enable"] = '拡張機能'
ja_jp["adblock_plus_settings"] = "Adblock 高度なフィルター" ja_jp["adblock_plus_settings"] = "Adblock 高度なフィルター"
ja_jp["disable_adjacent_seat"] = "連続しない座席も可" ja_jp["disable_adjacent_seat"] = "連続しない座席も可"

View File

@ -3,9 +3,9 @@
try: try:
# for Python2 # for Python2
from Tkinter import *
import ttk
import tkMessageBox as messagebox import tkMessageBox as messagebox
import ttk
from Tkinter import *
except ImportError: except ImportError:
# for Python3 # for Python3
from tkinter import * from tkinter import *
@ -13,22 +13,21 @@ except ImportError:
from tkinter import messagebox from tkinter import messagebox
from tkinter import filedialog from tkinter import filedialog
import os
import sys
import platform
import webbrowser
import pyperclip
import base64
import time
import threading
import socket
import asyncio import asyncio
import base64
import os
import platform
import socket
import sys
import threading
import time
import webbrowser
import pyperclip
import tornado import tornado
from tornado.web import Application from tornado.web import Application
CONST_APP_VERSION = "MaxBot (2023.10.15)" CONST_APP_VERSION = "MaxBot (2023.10.16)"
CONST_MAXBOT_QUESTION_FILE = "MAXBOT_QUESTION.txt" CONST_MAXBOT_QUESTION_FILE = "MAXBOT_QUESTION.txt"