Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/source/Usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

.+--------+----------------+---------------------+------------------+------------------+----------+------------+

| 车次 | 列车始发/终点站 | 余票情况 | 选择的始发/终点站 | 列车始发/终到时间 | 中途耗时 | 列车编号 |
| 车次 | 列车始发/终点站 | 余票情况 | 选择的始发/终点站 | 列车始发/终到时间 | 中途耗时 | 列车编号 |

.+========+================+======================+=================+==================+==========+============+

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,3 @@ python ./run.py

## 使用方式
(注:文档正在编写,但是可以先参阅[用法文档](https://github.com/F18-Maverick/EasyTicket/blob/main/Doc/source/Usage.rst))

4 changes: 0 additions & 4 deletions src/EasyTicket/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,3 @@
import app
def main():
app.run_function()




12 changes: 0 additions & 12 deletions src/EasyTicket/all_threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,3 @@ def download_ticket_station_info_thread(self, computer_height, computer_width):
target=get_ticket_info.get_ticket_station_info, args=(computer_height, computer_width),
name="thread4", daemon=True)
self.thread_station_info.start()












8 changes: 2 additions & 6 deletions src/EasyTicket/analyze_json/analyze_city_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ def __init__(self):
self.current_dir_this_file=""
for j in self.dir_bar_list:
self.current_dir_this_file+=j
self.city_json_path = os.path.join(self.current_dir_this_file, 'ticket_12306_prog_addition', 'city.json')
self.city_json_path = os.path.join(
self.current_dir_this_file, 'ticket_12306_prog_addition', 'city.json')
self.city_data=None
self.all_city=[]
self.ad_code=[]
Expand Down Expand Up @@ -41,8 +42,3 @@ def get_city_code(self):
self.city_Code = city_info["cityCode"]
self.city_code.append(self.city_Code)
return self.city_code





11 changes: 2 additions & 9 deletions src/EasyTicket/analyze_json/analyze_city_station_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ def __init__(self):
self.current_dir_this_file = ""
for j in self.dir_bar_list:
self.current_dir_this_file += j
self.city_station_json_path = os.path.join(self.current_dir_this_file, 'ticket_12306_prog_addition', 'cityTrain.json')
self.city_station_json_path = os.path.join(
self.current_dir_this_file, 'ticket_12306_prog_addition', 'cityTrain.json')
self.city_data=None
with open(self.city_station_json_path, 'r', encoding="utf-8") as self.city_station_json_file:
self.city_data = json.load(self.city_station_json_file)
Expand Down Expand Up @@ -53,11 +54,3 @@ def get_station_py_code(self):
self.station_py_code=every_city_info["py_code"]
self.station_py_code_list.append(self.station_py_code)
return self.station_py_code_list








5 changes: 0 additions & 5 deletions src/EasyTicket/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,3 @@ def __init__(self):
self.entry_place = self.run_get_ticket.Entry_Function()
self.entry_button = self.run_get_ticket.Windows_Button()
self.Main_Loop = main_loop()





11 changes: 0 additions & 11 deletions src/EasyTicket/bin/browsers_searcher/linux_browser_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,3 @@ def browsers() -> Iterator[Browser]:
yield Browser(
browser_type=browser_type, path=executable_path, display_name=display_name, version=version
)











13 changes: 0 additions & 13 deletions src/EasyTicket/bin/browsers_searcher/osx_browser_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,3 @@ def _reverse_brave_version(version: str) -> str:
major_minor, patch = version.split(".", 1)
major, minor = divmod(int(major_minor), 100)
return f"{major}.{minor}.{patch}"













10 changes: 0 additions & 10 deletions src/EasyTicket/bin/browsers_searcher/windows_browser_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,3 @@ def _get_file_version(file_path: str) -> str:
revision = dw_file_version_ls & 0xFFFF
return f"{major}.{minor}.{build}.{revision}"
return ""










14 changes: 0 additions & 14 deletions src/EasyTicket/bin/deal_browser_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,17 +233,3 @@ def copy_file():
return False
copy_btn = tkinter.Button(root, text="复制文件", command=copy_file, width=15)
copy_btn.pack(pady=10)














1 change: 0 additions & 1 deletion src/EasyTicket/bin/get_new_browser_driver_UI.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,3 @@ def on_confirm(self):
self.window.destroy()
else:
messagebox.showerror("错误", "保存信息失败")

54 changes: 24 additions & 30 deletions src/EasyTicket/bin/get_ticket_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ def __init__(self, main_window_height, main_window_width):
self.current_dir_this_file = ""
for j in self.dir_bar_list:
self.current_dir_this_file += j
self.ssl_context_dir=os.path.join(self.current_dir_this_file, "ticket_12306_prog_addition", "cacert.pem")
self.ssl_context_dir=os.path.join(
self.current_dir_this_file, "ticket_12306_prog_addition", "cacert.pem")
self.temp_dir = os.path.join(self.current_dir_this_file, "temp")
self.main_window_height=main_window_height
self.main_window_width=main_window_width
Expand All @@ -33,9 +34,12 @@ def __init__(self, main_window_height, main_window_width):
self.end_city=None
self.date_start=None
if os.path.exists(self.temp_dir):
self.temp_dir_start = os.path.join(self.temp_dir, "data_socket_start_station.log")
self.temp_dir_end = os.path.join(self.temp_dir, "data_socket_end_station.log")
self.temp_dir_date = os.path.join(self.temp_dir, "data_socket_start_date.log")
self.temp_dir_start = os.path.join(
self.temp_dir, "data_socket_start_station.log")
self.temp_dir_end = os.path.join(
self.temp_dir, "data_socket_end_station.log")
self.temp_dir_date = os.path.join(
self.temp_dir, "data_socket_start_date.log")
with open(self.temp_dir_start, "r", encoding="utf-8") as read_start:
self.read_condition_start=read_start.read()
with open(self.temp_dir_end, "r", encoding="utf-8") as read_end:
Expand Down Expand Up @@ -66,8 +70,10 @@ def Download_get_station_info(self):
self.station_name_url="https://kyfw.12306.cn/otn/resources/js/framework/station_name.js?station_version=1.9330"
self.train_info_url=\
"https://kyfw.12306.cn/otn/leftTicket/queryO?leftTicketDTO.train_date={}&leftTicketDTO.from_station={}&leftTicketDTO.to_station={}&purpose_codes={}"
self.add_url_headers = urllib.request.Request(url=self.station_name_url, headers=self.header)
self.response_url=urllib.request.urlopen(self.add_url_headers, context=self.constant)
self.add_url_headers = urllib.request.Request(
url=self.station_name_url, headers=self.header)
self.response_url=urllib.request.urlopen(
self.add_url_headers, context=self.constant)
self.station_name_info=self.response_url.read().decode("utf-8")
self.count=0
self.count_1 = []
Expand Down Expand Up @@ -98,7 +104,8 @@ def Download_get_station_info(self):
break
for all_station_name_index in range(len(self.count_1)-1):
self.station_name=""
for station_name_index in range(self.count_1[all_station_name_index]+1, self.count_1[all_station_name_index+1]):
for station_name_index in range(
self.count_1[all_station_name_index]+1, self.count_1[all_station_name_index+1]):
self.station_name+=all_station[station_name_index]
self.station_name_list.append(self.station_name)
for symbol_index_1 in range(len(all_station)):
Expand All @@ -111,11 +118,13 @@ def Download_get_station_info(self):
break
for all_station_symbol_index in range(len(self.count_4)-1):
self.station_symbol=""
for station_symbol_index in range(self.count_4[all_station_symbol_index]+1, self.count_4[all_station_symbol_index+1]):
for station_symbol_index in range(
self.count_4[all_station_symbol_index]+1, self.count_4[all_station_symbol_index+1]):
self.station_symbol+=all_station[station_symbol_index]
self.station_symbol_list.append(self.station_symbol)
for all_station_info_index in range(len(self.station_name_list)):
self.station_info_dict[self.station_name_list[all_station_info_index]]=self.station_symbol_list[all_station_info_index]
self.station_info_dict[
self.station_name_list[all_station_info_index]]=self.station_symbol_list[all_station_info_index]
if not os.path.exists(self.temp_dir):
os.makedirs(self.temp_dir)
with open(os.path.join(self.temp_dir, "station_name_info.json"), "w", encoding="utf-8") as datalog_write:
Expand All @@ -138,9 +147,12 @@ def Download_get_station_info(self):
message="请填写正确的购票信息(出发时间, 出发车站, 到达车站)")
else:
self.station_end_symbol=self.station_info_dict[self.end_city].upper()
self.train_info_url_compleat=self.train_info_url.format(self.date_start, self.station_start_symbol, self.station_end_symbol, "ADULT")
self.add_url_headers_train_info = urllib.request.Request(url=self.train_info_url_compleat, headers=self.header)
self.response_url_train = urllib.request.urlopen(self.add_url_headers_train_info, context=self.constant)
self.train_info_url_compleat=self.train_info_url.format(
self.date_start, self.station_start_symbol, self.station_end_symbol, "ADULT")
self.add_url_headers_train_info = urllib.request.Request(
url=self.train_info_url_compleat, headers=self.header)
self.response_url_train = urllib.request.urlopen(
self.add_url_headers_train_info, context=self.constant)
self.statude_code=self.response_url_train.getcode()
self.train_info = self.response_url_train.read().decode("utf-8")
self.train_info_dict=json.loads(self.train_info)
Expand Down Expand Up @@ -291,21 +303,3 @@ def Download_get_station_info(self):
self.date_start, self.start_city, self.end_city, self.reflex_table),
name="thread5", daemon=True)
self.ticket_choose_interface_thread.start()


















Loading