forked from Gilg4mesh/tixcraft_bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings_old.py
3335 lines (2655 loc) · 171 KB
/
settings_old.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python3
#encoding=utf-8
try:
import tkinter.font as tkfont
from tkinter import *
from tkinter import messagebox, ttk
from tkinter.filedialog import asksaveasfilename
except Exception as e:
pass
import asyncio
import base64
import json
import os
import platform
import ssl
import subprocess
import sys
import threading
import time
import warnings
import webbrowser
from datetime import datetime
import pyperclip
import tornado
from tornado.web import Application
from urllib3.exceptions import InsecureRequestWarning
import util
try:
import ddddocr
except Exception as exc:
pass
CONST_APP_VERSION = "MaxBot (2024.04.22)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
CONST_MAXBOT_EXTENSION_NAME = "Maxbotplus_1.0.0"
CONST_MAXBOT_EXTENSION_STATUS_JSON = "status.json"
CONST_MAXBOT_INT28_FILE = "MAXBOT_INT28_IDLE.txt"
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
CONST_MAXBOT_QUESTION_FILE = "MAXBOT_QUESTION.txt"
CONST_SERVER_PORT = 16888
CONST_FROM_TOP_TO_BOTTOM = "from top to bottom"
CONST_FROM_BOTTOM_TO_TOP = "from bottom to top"
CONST_CENTER = "center"
CONST_RANDOM = "random"
CONST_SELECT_ORDER_DEFAULT = CONST_RANDOM
CONST_SELECT_OPTIONS_DEFAULT = (CONST_FROM_TOP_TO_BOTTOM, CONST_FROM_BOTTOM_TO_TOP, CONST_CENTER, CONST_RANDOM)
CONST_EXCLUDE_DEFAULT = "\"輪椅\",\"身障\",\"身心 障礙\",\"Restricted View\",\"燈柱遮蔽\",\"視線不完整\""
CONST_CAPTCHA_SOUND_FILENAME_DEFAULT = "ding-dong.wav"
CONST_HOMEPAGE_DEFAULT = "https://tixcraft.com"
CONST_OCR_CAPTCH_IMAGE_SOURCE_NON_BROWSER = "NonBrowser"
CONST_OCR_CAPTCH_IMAGE_SOURCE_CANVAS = "canvas"
CONST_WEBDRIVER_TYPE_SELENIUM = "selenium"
CONST_WEBDRIVER_TYPE_UC = "undetected_chromedriver"
CONST_WEBDRIVER_TYPE_DP = "DrissionPage"
CONST_WEBDRIVER_TYPE_NODRIVER = "nodriver"
CONST_SUPPORTED_SITES = ["https://kktix.com"
,"https://tixcraft.com (拓元)"
,"https://ticketmaster.sg"
#,"https://ticketmaster.com"
,"https://teamear.tixcraft.com/ (添翼)"
,"https://www.indievox.com/ (獨立音樂)"
,"https://www.famiticket.com.tw (全網)"
,"https://ticket.ibon.com.tw/"
,"https://kham.com.tw/ (寬宏)"
,"https://ticket.com.tw/ (年代)"
,"https://tickets.udnfunlife.com/ (udn售票網)"
,"https://ticketplus.com.tw/ (遠大)"
,"===[香港或南半球的系統]==="
,"http://www.urbtix.hk/ (城市)"
,"https://www.cityline.com/ (買飛)"
,"https://hotshow.hkticketing.com/ (快達票)"
,"https://ticketing.galaxymacau.com/ (澳門銀河)"
,"http://premier.ticketek.com.au"
]
warnings.simplefilter('ignore',InsecureRequestWarning)
ssl._create_default_https_context = ssl._create_unverified_context
translate={}
URL_DONATE = 'https://max-everyday.com/about/#donate'
URL_HELP = 'https://max-everyday.com/2018/03/tixcraft-bot/'
URL_RELEASE = 'https://github.com/max32002/tixcraft_bot/releases'
URL_FB = 'https://www.facebook.com/maxbot.ticket'
URL_CHROME_DRIVER = 'https://chromedriver.chromium.org/'
URL_FIREFOX_DRIVER = 'https://github.com/mozilla/geckodriver/releases'
URL_EDGE_DRIVER = 'https://developer.microsoft.com/zh-tw/microsoft-edge/tools/webdriver/'
GLOBAL_SERVER_SHUTDOWN = False
def load_translate():
translate = {}
en_us={}
en_us["homepage"] = 'Homepage'
en_us["browser"] = 'Browser'
en_us["language"] = 'Language'
en_us["ticket_number"] = 'Ticker Number'
en_us["enable"] = 'Enable'
en_us["recommand_enable"] = "Recommended to enable"
en_us["auto_press_next_step_button"] = 'KKTIX Press Next Step Button'
en_us["auto_fill_ticket_number"] = 'Auto Fill Ticket Number'
en_us["and"] = 'And with'
en_us["local_dictionary"] = 'Local Dictionary'
en_us["remote_url"] = 'Remote URL'
en_us["server_url"] = 'Server URL'
en_us["auto_guess_options"] = 'Guess Options in Question'
en_us["user_guess_string"] = 'Fill Answers in Question'
en_us["preview"] = 'Preview'
en_us["question"] = 'Question'
en_us["answer"] = 'Answer'
en_us["date_auto_select"] = 'Date Auto Select'
en_us["date_select_order"] = 'Date select order'
en_us["date_keyword"] = 'Date Keyword'
en_us["pass_date_is_sold_out"] = 'Pass date is sold out'
en_us["auto_reload_coming_soon_page"] = 'Reload coming soon page'
en_us["auto_reload_page_interval"] = 'Reload page interval(sec.)'
en_us["max_dwell_time"] = 'KKTIX dwell time(sec.)'
en_us["cityline_queue_retry"] = 'cityline queue retry'
en_us["reset_browser_interval"] = 'Reset browser interval(sec.)'
en_us["proxy_server_port"] = 'Proxy IP:PORT'
en_us["window_size"] = 'Window size'
en_us["area_select_order"] = 'Area select order'
en_us["area_keyword"] = 'Area Keyword'
en_us["area_auto_select"] = 'Area Auto Select'
en_us["keyword_exclude"] = 'Keyword Exclude'
en_us["keyword_usage"] = 'Each keyword need double quotes, separated by comma,\nUse space in keyword as AND logic.\nAppend ,\"\" to match all.'
en_us["ocr_captcha"] = 'OCR captcha'
en_us["ocr_captcha_ddddocr_beta"] = 'ddddocr beta'
en_us["ocr_captcha_force_submit"] = 'Away from keyboard'
en_us["ocr_captcha_image_source"] = 'OCR image source'
en_us["webdriver_type"] = 'WebDriver type'
en_us["headless"] = 'Headless mode'
# Make the operation more talkative
en_us["verbose"] = 'Verbose mode'
en_us["running_status"] = 'Running Status'
en_us["running_url"] = 'Running URL'
en_us["system_clock"] = 'System Clock'
en_us["idle_keyword"] = 'Idle Keyword'
en_us["resume_keyword"] = 'Resume Keyword'
en_us["idle_keyword_second"] = 'Idle Keyword (second)'
en_us["resume_keyword_second"] = 'Resume Keyword (second)'
en_us["status_idle"] = 'Idle'
en_us["status_paused"] = 'Paused'
en_us["status_enabled"] = 'Enabled'
en_us["status_running"] = 'Running'
en_us["idle"] = 'Idle'
en_us["resume"] = 'Resume'
en_us["preference"] = 'Preference'
en_us["advanced"] = 'Advanced'
en_us["verification_word"] = "Verification"
en_us["maxbot_server"] = 'Server'
en_us["autofill"] = 'Autofill'
en_us["runtime"] = 'Runtime'
en_us["about"] = 'About'
en_us["run"] = 'Run'
en_us["save"] = 'Save'
en_us["exit"] = 'Close'
en_us["copy"] = 'Copy'
en_us["restore_defaults"] = 'Restore Defaults'
en_us["config_launcher"] = 'Launcher'
en_us["done"] = 'Done'
en_us["tixcraft_sid"] = 'Tixcraft family cookie SID'
en_us["ibon_ibonqware"] = 'ibon cookie ibonqware'
en_us["facebook_account"] = 'Facebook account'
en_us["kktix_account"] = 'KKTIX account'
en_us["fami_account"] = 'FamiTicket account'
en_us["cityline_account"] = 'cityline account'
en_us["urbtix_account"] = 'URBTIX account'
en_us["hkticketing_account"] = 'HKTICKETING account'
en_us["kham_account"] = 'KHAM account'
en_us["ticket_account"] = 'TICKET account'
en_us["udn_account"] = 'UDN account'
en_us["ticketplus_account"] = 'TicketPlus account'
en_us["password"] = 'Password'
en_us["facebook_password"] = 'Facebook password'
en_us["kktix_password"] = 'KKTIX password'
en_us["fami_password"] = 'FamiTicket password'
en_us["cityline_password"] = 'cityline password'
en_us["urbtix_password"] = 'URBTIX password'
en_us["hkticketing_password"] = 'HKTICKETING password'
en_us["kham_password"] = 'KHAM password'
en_us["ticket_password"] = 'TICKET password'
en_us["udn_password"] = 'UDN password'
en_us["ticketplus_password"] = 'TicketPlus password'
en_us["save_password_alert"] = 'Saving passwords to config file may expose your passwords.'
en_us["play_ticket_sound"] = 'Play sound when ticketing'
en_us["play_order_sound"] = 'Play sound when ordering'
en_us["play_sound_filename"] = 'sound filename'
en_us["chrome_extension"] = "Chrome Browser Extension"
en_us["disable_adjacent_seat"] = "Disable Adjacent Seat"
en_us["hide_some_image"] = "Hide Some Images"
en_us["block_facebook_network"] = "Block Facebook Network"
en_us["maxbot_slogan"] = 'MaxBot is a FREE and open source bot program. Wish you good luck.'
en_us["donate"] = 'Donate'
en_us["help"] = 'Help'
en_us["release"] = 'Release'
zh_tw={}
zh_tw["homepage"] = '售票網站'
zh_tw["browser"] = '瀏覽器'
zh_tw["language"] = '語言'
zh_tw["ticket_number"] = '門票張數'
zh_tw["enable"] = '啟用'
zh_tw["recommand_enable"] = "建議啟用"
zh_tw["auto_press_next_step_button"] = 'KKTIX點選下一步按鈕'
zh_tw["auto_fill_ticket_number"] = '自動輸入張數'
zh_tw["and"] = '而且(同列)'
zh_tw["local_dictionary"] = '使用者自定字典'
zh_tw["remote_url"] = '遠端網址'
zh_tw["server_url"] = '伺服器網址'
zh_tw["auto_guess_options"] = '自動猜測驗證問題'
zh_tw["user_guess_string"] = '驗證問題中的答案清單'
zh_tw["preview"] = '預覽'
zh_tw["question"] = '驗證問題'
zh_tw["answer"] = '答案'
zh_tw["date_auto_select"] = '日期自動點選'
zh_tw["date_select_order"] = '日期排序方式'
zh_tw["date_keyword"] = '日期關鍵字'
zh_tw["pass_date_is_sold_out"] = '避開「搶購一空」的日期'
zh_tw["auto_reload_coming_soon_page"] = '自動刷新倒數中的日期頁面'
zh_tw["auto_reload_page_interval"] = '自動刷新頁面間隔(秒)'
zh_tw["max_dwell_time"] = 'KKTIX購票最長停留(秒)'
zh_tw["reset_browser_interval"] = '重新啓動瀏覽器間隔(秒)'
zh_tw["cityline_queue_retry"] = 'cityline queue retry'
zh_tw["proxy_server_port"] = 'Proxy IP:PORT'
zh_tw["window_size"] = '瀏覽器視窗大小'
zh_tw["area_select_order"] = '區域排序方式'
zh_tw["area_keyword"] = '區域關鍵字'
zh_tw["area_auto_select"] = '區域自動點選'
zh_tw["keyword_exclude"] = '排除關鍵字'
zh_tw["keyword_usage"] = '每組關鍵字需要雙引號, 用逗號分隔, \n在關鍵字中使用空格作為 AND 邏輯。\n加入 ,\"\" 代表符合所有關鍵字'
zh_tw["ocr_captcha"] = '猜測驗證碼'
zh_tw["ocr_captcha_ddddocr_beta"] = 'ddddocr beta'
zh_tw["ocr_captcha_force_submit"] = '掛機模式'
zh_tw["ocr_captcha_image_source"] = 'OCR圖片取得方式'
zh_tw["webdriver_type"] = 'WebDriver類別'
zh_tw["headless"] = '無圖形界面模式'
zh_tw["verbose"] = '輸出詳細除錯訊息'
zh_tw["running_status"] = '執行狀態'
zh_tw["running_url"] = '執行網址'
zh_tw["system_clock"] = '系統時鐘'
zh_tw["idle_keyword"] = '暫停關鍵字'
zh_tw["resume_keyword"] = '接續關鍵字'
zh_tw["idle_keyword_second"] = '暫停關鍵字(秒)'
zh_tw["resume_keyword_second"] = '接續關鍵字(秒)'
zh_tw["status_idle"] = '閒置中'
zh_tw["status_paused"] = '已暫停'
zh_tw["status_enabled"] = '已啟用'
zh_tw["status_running"] = '執行中'
zh_tw["idle"] = '暫停搶票'
zh_tw["resume"] = '接續搶票'
zh_tw["preference"] = '偏好設定'
zh_tw["advanced"] = '進階設定'
zh_tw["verification_word"] = "驗證問題"
zh_tw["maxbot_server"] = '伺服器'
zh_tw["autofill"] = '自動填表單'
zh_tw["runtime"] = '執行階段'
zh_tw["about"] = '關於'
zh_tw["run"] = '搶票'
zh_tw["save"] = '存檔'
zh_tw["exit"] = '關閉'
zh_tw["copy"] = '複製'
zh_tw["restore_defaults"] = '恢復預設值'
zh_tw["config_launcher"] = '設定檔管理'
zh_tw["done"] = '完成'
zh_tw["tixcraft_sid"] = '拓元家族 cookie SID'
zh_tw["ibon_ibonqware"] = 'ibon cookie ibonqware'
zh_tw["facebook_account"] = 'Facebook 帳號'
zh_tw["kktix_account"] = 'KKTIX 帳號'
zh_tw["fami_account"] = 'FamiTicket 帳號'
zh_tw["cityline_account"] = 'cityline 帳號'
zh_tw["urbtix_account"] = 'URBTIX 帳號'
zh_tw["hkticketing_account"] = 'HKTICKETING 帳號'
zh_tw["kham_account"] = '寬宏 帳號'
zh_tw["ticket_account"] = '年代 帳號'
zh_tw["udn_account"] = 'UDN 帳號'
zh_tw["ticketplus_account"] = '遠大 帳號'
zh_tw["password"] = '密碼'
zh_tw["facebook_password"] = 'Facebook 密碼'
zh_tw["kktix_password"] = 'KKTIX 密碼'
zh_tw["fami_password"] = 'FamiTicket 密碼'
zh_tw["cityline_password"] = 'cityline 密碼'
zh_tw["urbtix_password"] = 'URBTIX 密碼'
zh_tw["hkticketing_password"] = 'HKTICKETING 密碼'
zh_tw["kham_password"] = '寬宏 密碼'
zh_tw["ticket_password"] = '年代 密碼'
zh_tw["udn_password"] = 'UDN 密碼'
zh_tw["ticketplus_password"] = '遠大 密碼'
zh_tw["save_password_alert"] = '將密碼保存到設定檔中可能會讓您的密碼被盜。'
zh_tw["play_ticket_sound"] = '有票時播放音效'
zh_tw["play_order_sound"] = '訂購時播放音效'
zh_tw["play_sound_filename"] = '音效檔'
zh_tw["chrome_extension"] = "Chrome 瀏覽器擴充功能"
zh_tw["disable_adjacent_seat"] = "允許不連續座位"
zh_tw["hide_some_image"] = "隱藏部份圖片"
zh_tw["block_facebook_network"] = "擋掉 Facebook 連線"
zh_tw["maxbot_slogan"] = 'MaxBot是一個免費、開放原始碼的搶票機器人。\n祝您搶票成功。'
zh_tw["donate"] = '打賞'
zh_tw["release"] = '所有可用版本'
zh_tw["help"] = '使用教學'
zh_cn={}
zh_cn["homepage"] = '售票网站'
zh_cn["browser"] = '浏览器'
zh_cn["language"] = '语言'
zh_cn["ticket_number"] = '门票张数'
zh_cn["enable"] = '启用'
zh_cn["recommand_enable"] = "建议启用"
zh_cn["auto_press_next_step_button"] = 'KKTIX自动点选下一步按钮'
zh_cn["auto_fill_ticket_number"] = '自动输入张数'
zh_cn["and"] = '而且(同列)'
zh_cn["local_dictionary"] = '本地字典'
zh_cn["remote_url"] = '远端网址'
zh_cn["server_url"] = '服务器地址'
zh_cn["auto_guess_options"] = '自动猜测验证问题'
zh_cn["user_guess_string"] = '验证问题的答案列表'
zh_cn["preview"] = '预览'
zh_cn["question"] = '验证问题'
zh_cn["answer"] = '答案'
zh_cn["date_auto_select"] = '日期自动点选'
zh_cn["date_select_order"] = '日期排序方式'
zh_cn["date_keyword"] = '日期关键字'
zh_cn["pass_date_is_sold_out"] = '避开“抢购一空”的日期'
zh_cn["auto_reload_coming_soon_page"] = '自动刷新倒数中的日期页面'
zh_cn["auto_reload_page_interval"] = '重新加载间隔(秒)'
zh_cn["cityline_queue_retry"] = 'cityline queue retry'
zh_cn["max_dwell_time"] = '购票网页最长停留(秒)'
zh_cn["reset_browser_interval"] = '重新启动浏览器间隔(秒)'
zh_cn["proxy_server_port"] = 'Proxy IP:PORT'
zh_cn["window_size"] = '浏览器窗口大小'
zh_cn["area_select_order"] = '区域排序方式'
zh_cn["area_keyword"] = '区域关键字'
zh_cn["area_auto_select"] = '区域自动点选'
zh_cn["keyword_exclude"] = '排除关键字'
zh_cn["keyword_usage"] = '每组关键字需要双引号, 用逗号分隔, \n在关键字中使用空格作为 AND 逻辑。\n附加 ,\"\" 以匹配所有结果。'
zh_cn["ocr_captcha"] = '猜测验证码'
zh_cn["ocr_captcha_ddddocr_beta"] = 'ddddocr beta'
zh_cn["ocr_captcha_force_submit"] = '挂机模式'
zh_cn["ocr_captcha_image_source"] = 'OCR图像源'
zh_cn["webdriver_type"] = 'WebDriver类别'
zh_cn["headless"] = '无图形界面模式'
zh_cn["verbose"] = '输出详细除错讯息'
zh_cn["running_status"] = '执行状态'
zh_cn["running_url"] = '执行网址'
zh_cn["system_clock"] = '系统时钟'
zh_cn["idle_keyword"] = '暂停关键字'
zh_cn["resume_keyword"] = '接续关键字'
zh_cn["idle_keyword_second"] = '暂停关键字(秒)'
zh_cn["resume_keyword_second"] = '接续关键字(秒)'
zh_cn["status_idle"] = '闲置中'
zh_cn["status_paused"] = '已暂停'
zh_cn["status_enabled"] = '已启用'
zh_cn["status_running"] = '执行中'
zh_cn["idle"] = '暂停抢票'
zh_cn["resume"] = '接续抢票'
zh_cn["preference"] = '偏好设定'
zh_cn["advanced"] = '进阶设定'
zh_cn["verification_word"] = "验证字"
zh_cn["maxbot_server"] = '伺服器'
zh_cn["autofill"] = '自动填表单'
zh_cn["runtime"] = '运行'
zh_cn["about"] = '关于'
zh_cn["copy"] = '复制'
zh_cn["run"] = '抢票'
zh_cn["save"] = '存档'
zh_cn["exit"] = '关闭'
zh_cn["copy"] = '复制'
zh_cn["restore_defaults"] = '恢复默认值'
zh_cn["config_launcher"] = '设定档管理'
zh_cn["done"] = '完成'
zh_cn["tixcraft_sid"] = '拓元家族 cookie SID'
zh_cn["ibon_ibonqware"] = 'ibon cookie ibonqware'
zh_cn["facebook_account"] = 'Facebook 帐号'
zh_cn["kktix_account"] = 'KKTIX 帐号'
zh_cn["fami_account"] = 'FamiTicket 帐号'
zh_cn["cityline_account"] = 'cityline 帐号'
zh_cn["urbtix_account"] = 'URBTIX 帐号'
zh_cn["hkticketing_account"] = 'HKTICKETING 帐号'
zh_cn["kham_account"] = '宽宏 帐号'
zh_cn["ticket_account"] = '年代 帐号'
zh_cn["udn_account"] = 'UDN 帐号'
zh_cn["ticketplus_account"] = '远大 帐号'
zh_cn["password"] = '密码'
zh_cn["facebook_password"] = 'Facebook 密码'
zh_cn["kktix_password"] = 'KKTIX 密码'
zh_cn["fami_password"] = 'FamiTicket 密码'
zh_cn["cityline_password"] = 'cityline 密码'
zh_cn["urbtix_password"] = 'URBTIX 密码'
zh_cn["hkticketing_password"] = 'HKTICKETING 密码'
zh_cn["kham_password"] = '宽宏 密码'
zh_cn["ticket_password"] = '年代 密码'
zh_cn["udn_password"] = 'UDN 密码'
zh_cn["ticketplus_password"] = '远大 密码'
zh_cn["save_password_alert"] = '将密码保存到文件中可能会暴露您的密码。'
zh_cn["play_ticket_sound"] = '有票时播放音效'
zh_cn["play_order_sound"] = '订购时播放音效'
zh_cn["play_sound_filename"] = '音效档'
zh_cn["chrome_extension"] = "Chrome 浏览器扩展程序"
zh_cn["disable_adjacent_seat"] = "允许不连续座位"
zh_cn["hide_some_image"] = "隐藏一些图像"
zh_cn["block_facebook_network"] = "擋掉 Facebook 連線"
zh_cn["maxbot_slogan"] = 'MaxBot 是一个免费的开源机器人程序。\n祝您抢票成功。'
zh_cn["donate"] = '打赏'
zh_cn["help"] = '使用教学'
zh_cn["release"] = '所有可用版本'
ja_jp={}
ja_jp["homepage"] = 'ホームページ'
ja_jp["browser"] = 'ブラウザ'
ja_jp["language"] = '言語'
ja_jp["ticket_number"] = '枚数'
ja_jp["enable"] = '有効'
ja_jp["recommand_enable"] = "有効化を推奨"
ja_jp["auto_press_next_step_button"] = 'KKTIX次を自動で押す'
ja_jp["auto_fill_ticket_number"] = '枚数自動入力'
ja_jp["and"] = 'そして(同列)'
ja_jp["local_dictionary"] = 'ローカル辞書'
ja_jp["remote_url"] = 'リモートURL'
ja_jp["server_url"] = 'サーバーURL'
ja_jp["auto_guess_options"] = '自動推測検証問題'
ja_jp["user_guess_string"] = '検証用の質問の回答リスト'
ja_jp["preview"] = 'プレビュー'
ja_jp["question"] = '質問'
ja_jp["answer"] = '答え'
ja_jp["date_auto_select"] = '日付自動選択'
ja_jp["date_select_order"] = '日付のソート方法'
ja_jp["date_keyword"] = '日付キーワード'
ja_jp["pass_date_is_sold_out"] = '「売り切れ」公演を避ける'
ja_jp["auto_reload_coming_soon_page"] = '公開予定のページをリロード'
ja_jp["auto_reload_page_interval"] = 'リロード間隔(秒)'
ja_jp["max_dwell_time"] = '最大滞留時間(秒)'
ja_jp["cityline_queue_retry"] = 'cityline queue retry'
ja_jp["reset_browser_interval"] = 'ブラウザの再起動間隔(秒)'
ja_jp["proxy_server_port"] = 'Proxy IP:PORT'
ja_jp["window_size"] = 'ウィンドウサイズ'
ja_jp["area_select_order"] = 'エリアソート方法'
ja_jp["area_keyword"] = 'エリアキーワード'
ja_jp["area_auto_select"] = 'エリア自動選択'
ja_jp["keyword_exclude"] = '除外キーワード'
ja_jp["keyword_usage"] = '各キーワードはカンマで区切られた二重引用符が必要です。\nキーワード内のスペースを AND ロジックとして使用します。\nすべてに一致するように ,\"\" を追加します。'
ja_jp["ocr_captcha"] = 'キャプチャを推測する'
ja_jp["ocr_captcha_ddddocr_beta"] = 'ddddocr beta'
ja_jp["ocr_captcha_force_submit"] = 'キーボードから離れて'
ja_jp["ocr_captcha_image_source"] = 'OCR 画像ソース'
ja_jp["webdriver_type"] = 'WebDriverタイプ'
ja_jp["headless"] = 'ヘッドレスモード'
ja_jp["verbose"] = '詳細モード'
ja_jp["running_status"] = 'スターテス'
ja_jp["running_url"] = '現在の URL'
ja_jp["system_clock"] = 'システムクロック'
ja_jp["idle_keyword"] = 'アイドルキーワード'
ja_jp["resume_keyword"] = '再起動キーワード'
ja_jp["idle_keyword_second"] = 'アイドルキーワード(秒)'
ja_jp["resume_keyword_second"] = '再起動キーワード(秒)'
ja_jp["status_idle"] = 'アイドル状態'
ja_jp["status_paused"] = '一時停止'
ja_jp["status_enabled"] = '有効'
ja_jp["status_running"] = 'ランニング'
ja_jp["idle"] = 'アイドル'
ja_jp["resume"] = '再起動'
ja_jp["preference"] = '設定'
ja_jp["advanced"] = '高度な設定'
ja_jp["verification_word"] = "確認の言葉"
ja_jp["maxbot_server"] = 'サーバ'
ja_jp["autofill"] = 'オートフィル'
ja_jp["runtime"] = 'ランタイム'
ja_jp["about"] = '情報'
ja_jp["run"] = 'チケットを取る'
ja_jp["save"] = '保存'
ja_jp["exit"] = '閉じる'
ja_jp["copy"] = 'コピー'
ja_jp["restore_defaults"] = 'デフォルトに戻す'
ja_jp["config_launcher"] = 'ランチャー'
ja_jp["done"] = '終わり'
ja_jp["tixcraft_sid"] = '拓元家 cookie SID'
ja_jp["ibon_ibonqware"] = 'ibon cookie ibonqware'
ja_jp["facebook_account"] = 'Facebookのアカウント'
ja_jp["kktix_account"] = 'KKTIXのアカウント'
ja_jp["fami_account"] = 'FamiTicketのアカウント'
ja_jp["cityline_account"] = 'citylineのアカウント'
ja_jp["urbtix_account"] = 'URBTIXのアカウント'
ja_jp["hkticketing_account"] = 'HKTICKETINGのアカウント'
ja_jp["kham_account"] = 'KHAMのアカウント'
ja_jp["ticket_account"] = 'TICKETのアカウント'
ja_jp["udn_account"] = 'UDNのアカウント'
ja_jp["ticketplus_account"] = '遠大のアカウント'
ja_jp["password"] = 'パスワード'
ja_jp["facebook_password"] = 'Facebookのパスワード'
ja_jp["kktix_password"] = 'KKTIXのパスワード'
ja_jp["fami_password"] = 'FamiTicketのパスワード'
ja_jp["cityline_password"] = 'citylineのパスワード'
ja_jp["urbtix_password"] = 'URBTIXのパスワード'
ja_jp["hkticketing_password"] = 'HKTICKETINGのパスワード'
ja_jp["kham_password"] = 'KHAMのパスワード'
ja_jp["ticket_password"] = 'TICKETのパスワード'
ja_jp["udn_password"] = 'UDNのパスワード'
ja_jp["ticketplus_password"] = '遠大のパスワード'
ja_jp["save_password_alert"] = 'パスワードをファイルに保存すると、パスワードが公開される可能性があります。'
ja_jp["play_ticket_sound"] = '有票時に音を鳴らす'
ja_jp["play_order_sound"] = '注文時に音を鳴らす'
ja_jp["play_sound_filename"] = 'サウンドファイル'
ja_jp["chrome_extension"] = "Chrome ブラウザ拡張機能"
ja_jp["disable_adjacent_seat"] = "連続しない座席も可"
ja_jp["hide_some_image"] = "一部の画像を非表示にする"
ja_jp["block_facebook_network"] = "Facebookをブロックする"
ja_jp["maxbot_slogan"] = 'MaxBot は無料のオープン ソース ボット プログラムです。チケットの成功をお祈りします。'
ja_jp["donate"] = '寄付'
ja_jp["help"] = '利用方法'
ja_jp["release"] = 'リリース'
translate['en_us']=en_us
translate['zh_tw']=zh_tw
translate['zh_cn']=zh_cn
translate['ja_jp']=ja_jp
return translate
def get_default_config():
config_dict={}
config_dict["homepage"] = CONST_HOMEPAGE_DEFAULT
config_dict["browser"] = "chrome"
config_dict["language"] = "English"
config_dict["ticket_number"] = 2
config_dict["ocr_captcha"] = {}
config_dict["ocr_captcha"]["enable"] = True
config_dict["ocr_captcha"]["beta"] = True
config_dict["ocr_captcha"]["force_submit"] = True
config_dict["ocr_captcha"]["image_source"] = CONST_OCR_CAPTCH_IMAGE_SOURCE_CANVAS
config_dict["webdriver_type"] = CONST_WEBDRIVER_TYPE_UC
config_dict["date_auto_select"] = {}
config_dict["date_auto_select"]["enable"] = True
config_dict["date_auto_select"]["date_keyword"] = ""
config_dict["date_auto_select"]["mode"] = CONST_SELECT_ORDER_DEFAULT
config_dict["area_auto_select"] = {}
config_dict["area_auto_select"]["enable"] = True
config_dict["area_auto_select"]["mode"] = CONST_SELECT_ORDER_DEFAULT
config_dict["area_auto_select"]["area_keyword"] = ""
config_dict["keyword_exclude"] = CONST_EXCLUDE_DEFAULT
config_dict['kktix']={}
config_dict["kktix"]["auto_press_next_step_button"] = True
config_dict["kktix"]["auto_fill_ticket_number"] = True
config_dict["kktix"]["max_dwell_time"] = 60
config_dict['cityline']={}
config_dict["cityline"]["cityline_queue_retry"] = True
config_dict['tixcraft']={}
config_dict["tixcraft"]["pass_date_is_sold_out"] = True
config_dict["tixcraft"]["auto_reload_coming_soon_page"] = True
config_dict['advanced']={}
config_dict['advanced']['play_sound']={}
config_dict["advanced"]["play_sound"]["ticket"] = True
config_dict["advanced"]["play_sound"]["order"] = True
config_dict["advanced"]["play_sound"]["filename"] = CONST_CAPTCHA_SOUND_FILENAME_DEFAULT
config_dict["advanced"]["tixcraft_sid"] = ""
config_dict["advanced"]["ibonqware"] = ""
config_dict["advanced"]["facebook_account"] = ""
config_dict["advanced"]["kktix_account"] = ""
config_dict["advanced"]["fami_account"] = ""
config_dict["advanced"]["cityline_account"] = ""
config_dict["advanced"]["urbtix_account"] = ""
config_dict["advanced"]["hkticketing_account"] = ""
config_dict["advanced"]["kham_account"] = ""
config_dict["advanced"]["ticket_account"] = ""
config_dict["advanced"]["udn_account"] = ""
config_dict["advanced"]["ticketplus_account"] = ""
config_dict["advanced"]["facebook_password"] = ""
config_dict["advanced"]["kktix_password"] = ""
config_dict["advanced"]["fami_password"] = ""
config_dict["advanced"]["urbtix_password"] = ""
config_dict["advanced"]["cityline_password"] = ""
config_dict["advanced"]["hkticketing_password"] = ""
config_dict["advanced"]["kham_password"] = ""
config_dict["advanced"]["ticket_password"] = ""
config_dict["advanced"]["udn_password"] = ""
config_dict["advanced"]["ticketplus_password"] = ""
config_dict["advanced"]["facebook_password_plaintext"] = ""
config_dict["advanced"]["kktix_password_plaintext"] = ""
config_dict["advanced"]["fami_password_plaintext"] = ""
config_dict["advanced"]["urbtix_password_plaintext"] = ""
config_dict["advanced"]["cityline_password_plaintext"] = ""
config_dict["advanced"]["hkticketing_password_plaintext"] = ""
config_dict["advanced"]["kham_password_plaintext"] = ""
config_dict["advanced"]["ticket_password_plaintext"] = ""
config_dict["advanced"]["udn_password_plaintext"] = ""
config_dict["advanced"]["ticketplus_password_plaintext"] = ""
config_dict["advanced"]["chrome_extension"] = True
config_dict["advanced"]["disable_adjacent_seat"] = False
config_dict["advanced"]["hide_some_image"] = False
config_dict["advanced"]["block_facebook_network"] = False
config_dict["advanced"]["headless"] = False
config_dict["advanced"]["verbose"] = False
config_dict["advanced"]["auto_guess_options"] = True
config_dict["advanced"]["user_guess_string"] = ""
config_dict["advanced"]["remote_url"] = "http://127.0.0.1:%d/" % (CONST_SERVER_PORT)
config_dict["advanced"]["auto_reload_page_interval"] = 0.1
config_dict["advanced"]["auto_reload_overheat_count"] = 4
config_dict["advanced"]["auto_reload_overheat_cd"] = 1.0
config_dict["advanced"]["reset_browser_interval"] = 0
config_dict["advanced"]["proxy_server_port"] = ""
config_dict["advanced"]["window_size"] = "480,1024"
config_dict["advanced"]["idle_keyword"] = ""
config_dict["advanced"]["resume_keyword"] = ""
config_dict["advanced"]["idle_keyword_second"] = ""
config_dict["advanced"]["resume_keyword_second"] = ""
return config_dict
def read_last_url_from_file():
ret = ""
if os.path.exists(CONST_MAXBOT_LAST_URL_FILE):
try:
with open(CONST_MAXBOT_LAST_URL_FILE, "r") as text_file:
ret = text_file.readline()
except Exception as e:
pass
return ret
def load_json():
app_root = util.get_app_root()
# overwrite config path.
config_filepath = os.path.join(app_root, CONST_MAXBOT_CONFIG_FILE)
config_dict = None
if os.path.isfile(config_filepath):
try:
with open(config_filepath) as json_data:
config_dict = json.load(json_data)
except Exception as e:
pass
else:
config_dict = get_default_config()
return config_filepath, config_dict
def btn_restore_defaults_clicked():
app_root = util.get_app_root()
config_filepath = os.path.join(app_root, CONST_MAXBOT_CONFIG_FILE)
if os.path.exists(str(config_filepath)):
try:
os.unlink(str(config_filepath))
except Exception as exc:
print(exc)
pass
config_dict = get_default_config()
language_code = get_language_code_by_name(config_dict["language"])
messagebox.showinfo(translate[language_code]["restore_defaults"], translate[language_code]["done"])
global root
load_GUI(root, config_dict)
def do_maxbot_idle():
app_root = util.get_app_root()
idle_filepath = os.path.join(app_root, CONST_MAXBOT_INT28_FILE)
try:
with open(CONST_MAXBOT_INT28_FILE, "w") as text_file:
text_file.write("")
except Exception as e:
pass
def btn_idle_clicked(language_code):
do_maxbot_idle()
update_maxbot_runtime_status()
def do_maxbot_resume():
app_root = util.get_app_root()
idle_filepath = os.path.join(app_root, CONST_MAXBOT_INT28_FILE)
for i in range(3):
util.force_remove_file(idle_filepath)
def btn_resume_clicked(language_code):
do_maxbot_resume()
update_maxbot_runtime_status()
def btn_launcher_clicked():
Root_Dir = ""
save_ret = btn_save_act(slience_mode=True)
if save_ret:
script_name = "config_launcher"
threading.Thread(target=util.launch_maxbot, args=(script_name,)).start()
def btn_save_clicked():
btn_save_act()
def btn_save_act(slience_mode=False):
app_root = util.get_app_root()
config_filepath = os.path.join(app_root, CONST_MAXBOT_CONFIG_FILE)
config_dict = get_default_config()
language_code = get_language_code_by_name(config_dict["language"])
# read user input
global combo_homepage
global combo_browser
global combo_language
global combo_ticket_number
global chk_state_auto_press_next_step_button
global chk_state_auto_fill_ticket_number
global txt_user_guess_string
global chk_state_date_auto_select
global txt_date_keyword
global chk_state_area_auto_select
global txt_area_keyword
global txt_keyword_exclude
global txt_remote_url
global combo_date_auto_select_mode
global combo_area_auto_select_mode
global chk_state_pass_date_is_sold_out
global chk_state_auto_reload_coming_soon_page
global txt_auto_reload_page_interval
global txt_max_dwell_time
global chk_status_cityline_queue_retry
global txt_reset_browser_intervalv
global txt_proxy_server_port
global txt_window_size
global txt_tixcraft_sid
global txt_ibon_ibonqware
global txt_facebook_account
global txt_kktix_account
global txt_fami_account
global txt_cityline_account
global txt_urbtix_account
global txt_hkticketing_account
global txt_kham_account
global txt_ticket_account
global txt_udn_account
global txt_ticketplus_account
global txt_facebook_password
global txt_kktix_password
global txt_fami_password
global txt_cityline_password
global txt_urbtix_password
global txt_hkticketing_password
global txt_kham_password
global txt_ticket_password
global txt_udn_password
global txt_ticketplus_password
global chk_state_play_ticket_sound
global chk_state_play_order_sound
global txt_play_sound_filename
global chk_state_ocr_captcha
global chk_state_ocr_captcha_ddddocr_beta
global chk_state_ocr_captcha_force_submit
global chk_state_chrome_extension
global chk_state_adjacent_seat
global chk_state_hide_some_image
global chk_state_block_facebook_network
global chk_state_headless
global chk_state_verbose
global chk_state_auto_guess_options
global combo_ocr_captcha_image_source
global combo_webdriver_type
global txt_idle_keyword
global txt_resume_keyword
global txt_idle_keyword_second
global txt_resume_keyword_second
is_all_data_correct = True
if is_all_data_correct:
if combo_homepage.get().strip()=="":
is_all_data_correct = False
messagebox.showerror("Error", "Please enter homepage")
else:
homepage_domain = combo_homepage.get().strip()
if ' (' in homepage_domain:
homepage_domain = homepage_domain.split(' (')[0]
config_dict["homepage"] = homepage_domain
if is_all_data_correct:
if combo_browser.get().strip()=="":
is_all_data_correct = False
messagebox.showerror("Error", "Please select a browser: chrome or firefox")
else:
config_dict["browser"] = combo_browser.get().strip()
if is_all_data_correct:
if combo_language.get().strip()=="":
is_all_data_correct = False
messagebox.showerror("Error", "Please select a language")
else:
config_dict["language"] = combo_language.get().strip()
# display as new language.
language_code = get_language_code_by_name(config_dict["language"])
if is_all_data_correct:
if combo_ticket_number.get().strip()=="":
is_all_data_correct = False
messagebox.showerror("Error", "Please select a value")
else:
config_dict["ticket_number"] = int(combo_ticket_number.get().strip())
if is_all_data_correct:
config_dict["kktix"]["auto_press_next_step_button"] = bool(chk_state_auto_press_next_step_button.get())
config_dict["kktix"]["auto_fill_ticket_number"] = bool(chk_state_auto_fill_ticket_number.get())
config_dict["kktix"]["max_dwell_time"] = int(txt_max_dwell_time.get().strip())
if config_dict["kktix"]["max_dwell_time"] > 0:
if config_dict["kktix"]["max_dwell_time"] < 15:
config_dict["kktix"]["max_dwell_time"] = 15
config_dict["cityline"]["cityline_queue_retry"] = bool(chk_state_cityline_queue_retry.get())
config_dict["date_auto_select"]["enable"] = bool(chk_state_date_auto_select.get())
config_dict["date_auto_select"]["mode"] = combo_date_auto_select_mode.get().strip()
date_keyword = txt_date_keyword.get("1.0",END).strip()
date_keyword = util.format_config_keyword_for_json(date_keyword)
config_dict["date_auto_select"]["date_keyword"] = date_keyword
config_dict["tixcraft"]["pass_date_is_sold_out"] = bool(chk_state_pass_date_is_sold_out.get())
config_dict["tixcraft"]["auto_reload_coming_soon_page"] = bool(chk_state_auto_reload_coming_soon_page.get())
area_keyword = txt_area_keyword.get("1.0",END).strip()
area_keyword = util.format_config_keyword_for_json(area_keyword)
keyword_exclude = txt_keyword_exclude.get("1.0",END).strip()
keyword_exclude = util.format_config_keyword_for_json(keyword_exclude)
user_guess_string = txt_user_guess_string.get("1.0",END).strip()
user_guess_string = util.format_config_keyword_for_json(user_guess_string)
remote_url = txt_remote_url.get("1.0",END).strip()
remote_url = util.format_config_keyword_for_json(remote_url)
idle_keyword = txt_idle_keyword.get("1.0",END).strip()
idle_keyword = util.format_config_keyword_for_json(idle_keyword)
resume_keyword = txt_resume_keyword.get("1.0",END).strip()
resume_keyword = util.format_config_keyword_for_json(resume_keyword)
idle_keyword_second = txt_idle_keyword_second.get("1.0",END).strip()
idle_keyword_second = util.format_config_keyword_for_json(idle_keyword_second)
resume_keyword_second = txt_resume_keyword_second.get("1.0",END).strip()
resume_keyword_second = util.format_config_keyword_for_json(resume_keyword_second)
# test keyword format.
if is_all_data_correct:
if len(area_keyword) > 0:
try:
test_array = json.loads("["+ area_keyword +"]")
except Exception as exc:
print(exc)
messagebox.showinfo(translate[language_code]["save"], "Error:" + translate[language_code]["area_keyword"])
is_all_data_correct = False
if is_all_data_correct:
if len(keyword_exclude) > 0:
try:
test_array = json.loads("["+ keyword_exclude +"]")
except Exception as exc:
print(exc)
messagebox.showinfo(translate[language_code]["save"], "Error:" + translate[language_code]["keyword_exclude"])
is_all_data_correct = False
if is_all_data_correct:
if len(user_guess_string) > 0:
try:
test_array = json.loads("["+ user_guess_string +"]")
except Exception as exc:
print(exc)
messagebox.showinfo(translate[language_code]["save"], "Error:" + translate[language_code]["user_guess_string"])
is_all_data_correct = False
if is_all_data_correct:
if len(remote_url) > 0:
try:
test_array = json.loads("["+ remote_url +"]")
except Exception as exc:
print(exc)
messagebox.showinfo(translate[language_code]["save"], "Error:" + translate[language_code]["remote_url"])
is_all_data_correct = False
if is_all_data_correct:
if len(idle_keyword) > 0:
try:
test_array = json.loads("["+ idle_keyword +"]")
except Exception as exc:
print(exc)
messagebox.showinfo(translate[language_code]["save"], "Error:" + translate[language_code]["idle_keyword"])
is_all_data_correct = False
if is_all_data_correct:
if len(resume_keyword) > 0:
try:
test_array = json.loads("["+ resume_keyword +"]")
except Exception as exc:
print(exc)
messagebox.showinfo(translate[language_code]["save"], "Error:" + translate[language_code]["resume_keyword"])
is_all_data_correct = False
if is_all_data_correct:
if len(idle_keyword_second) > 0:
try:
test_array = json.loads("["+ idle_keyword_second +"]")
except Exception as exc:
print(exc)
messagebox.showinfo(translate[language_code]["save"], "Error:" + translate[language_code]["idle_keyword_second"])
is_all_data_correct = False
if is_all_data_correct:
if len(resume_keyword_second) > 0:
try:
test_array = json.loads("["+ resume_keyword_second +"]")
except Exception as exc:
print(exc)