Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
BreezeWhite committed Dec 14, 2021
1 parent 8673953 commit 1442b33
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 7 deletions.
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
__pycache__
test.py
.mypy_cache/
.pytest_cache/
.db/
.venv/
build/
dist/
*.egg-info/

*.png
thsr_workspace.code-workspace
test.py
*.code-workspace
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@

本程式由python語言所寫成,因此必須先安裝python才能夠使用。官方下載網址[點這裡](https://www.python.org/downloads/release/python-381/)

### 方法一 (快速)
在已經有安裝好python的環境下,執行以下指令
``` bash
pip install git+https://github.com/BreezeWhite/THSR-Ticket.git

# 執行
thsr-ticket
```

### 方法二
首先先將程式碼下載到本機,執行以下指令或是直接按右上方的下載按鈕

```
Expand All @@ -36,6 +46,8 @@ python -m pip install -r requirements.txt
python thsr_ticket/main.py
```



## 注意事項!!!

本程式依舊有許多尚未完成的部分,僅具備基本訂購的功能,若是僅需要訂購成人票、且無特殊需求者,此程式對您而言是加速訂購流程的方便小工具。不符合以上描述者,目前仍建議使用官方網頁進行訂購。
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
requirements = in_file.readlines()

setup(
name='thsr_ticket',
name='thsr-ticket',
version='0.1',
description='An automatic booking program for Taiwan High Speed Railway(THSR).',
author='BreezeWhite',
author_email='[email protected]',
packages=find_packages(),
install_requires=requirements,
entry_points={'console_scripts': ['thsr = thsr_ticket.main:main']}
entry_points={'console_scripts': ['thsr-ticket = thsr_ticket.main:main']}
)
3 changes: 3 additions & 0 deletions thsr_ticket/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import os

MODULE_PATH = os.path.abspath(__file__ + "/..")
2 changes: 0 additions & 2 deletions thsr_ticket/controller/booking_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
from PIL import Image

from requests.models import Response
import matplotlib.pyplot as plt # type: ignore
import numpy as np # type: ignore
from bs4 import BeautifulSoup

from thsr_ticket.remote.http_request import HTTPRequest
Expand Down
5 changes: 4 additions & 1 deletion thsr_ticket/model/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from tinydb import TinyDB, Query
from tinydb.database import Document

from thsr_ticket import MODULE_PATH
from thsr_ticket.model.web.booking_form.booking_form import BookingForm
from thsr_ticket.model.web.confirm_ticket import ConfirmTicket

Expand All @@ -18,7 +19,9 @@ class Record(NamedTuple):


class ParamDB:
def __init__(self, db_path: str = "./.db/history.json"):
def __init__(self, db_path: str = None):
if db_path is None:
db_path = os.path.join(MODULE_PATH, ".db", "history.json")
self.db_path = db_path
db_dir = db_path[:db_path.rfind("/")]
if not os.path.exists(db_dir):
Expand Down

0 comments on commit 1442b33

Please sign in to comment.