Skip to content

Commit

Permalink
Merge pull request #51 from Jim137/toPub
Browse files Browse the repository at this point in the history
v0.4.1
  • Loading branch information
Jim137 authored May 2, 2024
2 parents 549d3c2 + 961a471 commit c4d0a31
Show file tree
Hide file tree
Showing 25 changed files with 950 additions and 247 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Logging tenhou paifu into excel, csv or html file with some key information.

If you like this project, please leave a star. It will be a great encouragement for me. And if you have any suggestions, please feel free to create an issue.

[Downloads](https://github.com/Jim137/Tenhou-Paifu-Logger/releases/latest) | [中文說明](https://github.com/Jim137/Tenhou-Paifu-Logger/blob/master/READMEs/README_zh.md) | [日本語](https://github.com/Jim137/Tenhou-Paifu-Logger/blob/master/READMEs/README_ja.md)
[Downloads](https://github.com/Jim137/Tenhou-Paifu-Logger/releases/latest) | [繁體中文](https://github.com/Jim137/Tenhou-Paifu-Logger/blob/master/READMEs/README_zh_TW.md) | [简体中文](https://github.com/Jim137/Tenhou-Paifu-Logger/blob/master/READMEs/README_zh.md) | [日本語](https://github.com/Jim137/Tenhou-Paifu-Logger/blob/master/READMEs/README_ja.md)

## Requirements

Expand Down Expand Up @@ -74,11 +74,11 @@ Note: In the latest version, you can input multiple URLs at once, separated by w
You can manually log the paifu by the following code.
```python
from paifulogger import get_paifu, localized_str, log_paifu, main_path
from paifulogger import get_paifu, localized_str, log_paifu
from paifulogger.log import _get_log_func
url = "Your paifu URL"
local_lang = localized_str("en", main_path) # Localization
local_lang = localized_str("en") # Localization
log_formats = _get_log_func(["csv", "html"]) # Log into csv and html file.
output = "./" # Output directory
mjai = False # Whether have output in mjai format
Expand Down Expand Up @@ -113,6 +113,8 @@ paifu = get_paifu(url, local_lang)
* Windows: `%localappdata%\Jim137\paifulogger\config.json`
* macOS: `/Users/{UserName}/Library/Application Support/paifulogger/config.json`
* Linux: `~/.local/share/paifulogger/config.json`
* [x] Support logging from Tenhou client(*.mjlog). (-c, --from-client DIR_TO_MJLOG)\
Note: Tpyically, the saved directory is `{Documents}/My Tenhou/log/` on Windows.

## Information logged

Expand Down
7 changes: 5 additions & 2 deletions READMEs/README_ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ CSV、ExcelまたはHTMLファイルに天鳳の牌譜をいくつかの主要

このプロジェクトが気に入った場合は、スターを付けていただけると大変励みになります。また、提案がある場合は、遠慮なく問題を作成してください。

[ダウンロード](https://github.com/Jim137/Tenhou-Paifu-Logger/releases/latest) | [English](https://github.com/Jim137/Tenhou-Paifu-Logger/blob/master/README.md) | [中文說明](https://github.com/Jim137/Tenhou-Paifu-Logger/blob/master/READMEs/README_zh.md)
[ダウンロード](https://github.com/Jim137/Tenhou-Paifu-Logger/releases/latest) | [English](https://github.com/Jim137/Tenhou-Paifu-Logger/blob/master/README.md) | [繁體中文](https://github.com/Jim137/Tenhou-Paifu-Logger/blob/master/READMEs/README_zh_TW.md) | [简体中文](https://github.com/Jim137/Tenhou-Paifu-Logger/blob/master/READMEs/README_zh.md)

## 使い方

Expand Down Expand Up @@ -45,7 +45,10 @@ CSV、ExcelまたはHTMLファイルに天鳳の牌譜をいくつかの主要
>>ii. 天鳳.netから牌譜のURLをクリップボードにコピーします。次に、次のコマンドを入力します。
>>
>> ```
>> plog -l [言語] -o [出力ディレクトリ] [牌譜のURL]
>> plog -l ja -o [出力ディレクトリ] [牌譜のURL]
>> ```
>> ```
>> paifu plog -l ja -o [出力ディレクトリ] [牌譜のURL]
>> ```
2. 一度 ![Enter URLs](image/README_ja/enter_url.png) が表示されると、牌譜のURLを貼り付けてEnterキーを押します。\
Expand Down
105 changes: 59 additions & 46 deletions READMEs/README_zh.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 天鳳牌譜記錄器
# 天凤牌谱记录器

[![build](https://github.com/Jim137/Tenhou-Paifu-Logger/actions/workflows/publish-to-test-pypi.yml/badge.svg)](https://github.com/Jim137/Tenhou-Paifu-Logger/actions/workflows/publish-to-test-pypi.yml)
[![lint](https://github.com/Jim137/Tenhou-Paifu-Logger/actions/workflows/test.yml/badge.svg)](https://github.com/Jim137/Tenhou-Paifu-Logger/actions/workflows/test.yml)
Expand All @@ -10,69 +10,82 @@
![platform](https://img.shields.io/badge/platform-Windows%20%7C%20macOS%20%7C%20Linux-lightgray?style=plastic)
![License](https://img.shields.io/github/license/Jim137/Tenhou-Paifu-Logger?style=plastic)

快速記錄天鳳牌譜的工具
快速记录天凤牌谱的工具

![Generated by DALL·E](https://github.com/Jim137/Tenhou-Paifu-Logger/raw/master/READMEs/image/paifulogger.png)
![DALL·E 生成](https://github.com/Jim137/Tenhou-Paifu-Logger/raw/master/READMEs/image/paifulogger.png)

如果你喜歡這個專案,請給我一顆star,這將會是我很大的鼓勵。如果你有任何建議,歡迎開issue來討論。
如果你喜欢这个项目,请给我一颗 star,这将会是我很大的鼓励。如果你有任何建议,欢迎开issue来讨论。

[下载](https://github.com/Jim137/Tenhou-Paifu-Logger/releases/latest) | [English](https://github.com/Jim137/Tenhou-Paifu-Logger/blob/master/README.md) | [繁體中文](https://github.com/Jim137/Tenhou-Paifu-Logger/blob/master/READMEs/README_zh_TW.md) |[日本語](https://github.com/Jim137/Tenhou-Paifu-Logger/blob/master/READMEs/README_ja.md)

[下載](https://github.com/Jim137/Tenhou-Paifu-Logger/releases/latest) | [English](https://github.com/Jim137/Tenhou-Paifu-Logger/blob/master/README.md) | [日本語](https://github.com/Jim137/Tenhou-Paifu-Logger/blob/master/READMEs/README_ja.md)
## 使用方法

1. Clone此專案或下載[最新版本](https://github.com/Jim137/Tenhou-Paifu-Logger/releases/latest)或使用pip下載。

`git clone https://github.com/Jim137/Tenhou-Paifu-Logger.git`
1. 克隆此项目或下载[最新版本](https://github.com/Jim137/Tenhou-Paifu-Logger/releases/latest)或使用pip下载。

```shell
git clone https://github.com/Jim137/Tenhou-Paifu-Logger.git
```
```shell
pip install PaifuLogger
```

`pip install PaifuLogger`

2. 首次使用時,右鍵編輯 `runlog-user.bat` (Linux用戶則 `runlog-user.sh` ),在set LANG= (export LANG=)後加上語言代碼 `zh_tw`,保存後運行此檔案。
使用pip則運行以下命令。
2. 首次使用时,右键编辑 `runlog-user.bat` (Linux 用户则 `runlog-user.sh` ),在 set LANG= (export LANG=)后加上语言代码 `zh` ,保存后运行此文件。
使用 pip 则运行以下命令。

`plog -l zh_tw -o <輸出目錄> (-r <多個牌譜網址>)`
```shell
plog -l zh -o <输出目录> <多个牌谱网址>
```
```shell
paifu plog -l zh -o <输出目录> <多个牌谱网址>
```

3. 複製天鳳牌譜至剪貼簿
4. 在出現![1675260159266](image/README_zh/1675260159266.png)後,貼上天鳳牌譜並按下Enter\
注意:在最新版本中,你可以一次輸入多個牌譜網址,用任何你喜歡的符號隔開即可。如果你很懶,你也可以直接貼上,不用加任何符號
5. 當出現![1675260331020](image/README_zh/1675260331020.png)後,則表示牌譜已經成功記錄
6. 當再次出現![1675260159266](image/README_zh/1675260159266.png),即可輸入下個牌譜
3. 复制天凤牌谱至剪贴板
4. 在出现 `请输入牌谱网址:` 后,粘贴天凤牌谱并按下 Enter。\
注意:在最新版本中,你可以一次输入多个牌谱网址,用任何你喜欢的符号隔开即可。如果你很懒,你也可以直接粘贴,不用加任何符号
5. 当出现 `已将{牌谱}牌谱记录` 后,则表示牌谱已经成功记录
6. 当再次出现 `请输入牌谱网址:`,即可输入下个牌谱

## 功能
* [x] 支援一次輸入多個牌譜網址。
* [x] 將牌譜記錄到csv、Excel或html檔案中。
* [x] 支援一次輸出多個格式。(例:-f csv -f html; -a, --all-formats)
* [x] 區分三麻和四麻,並分別記錄到不同的檔案中。
* [x] 跳過已記錄過的牌譜。
* [x] 重製已記錄過的牌譜(-r, --remake)。當我們更新了牌譜記錄的內容時,這個功能將會很有用。
* [x] 指定輸出目錄(-o, --output)
* [x] 支援mjai牌譜輸出(--mjai)。*首次需要先執行 `git pull --recurse-submodules`*
* [x] 本地化支援(-l, --language)

* [x] 支持一次输入多个牌谱网址。
* [x] 将牌谱记录到csv、Excel或html文件中。
* [x] 支持一次输出多个格式。(例:-f csv -f html; -a, --all-formats)
* [x] 区分三麻和四麻,并分别记录到不同的文件中。
* [x] 跳过已记录过的牌谱。
* [x] 重置已记录过的牌谱(-r, --remake)。当我们更新了牌谱记录的内容时,这个功能将会很有用。
* [x] 指定输出目录(-o, --output)
* [x] 支持mjai牌谱输出(--mjai)。*首次需要先执行 `git pull --recurse-submodules`*
* [x] 本地化支持(-l, --language)
* [x] 英文: en
* [x] 繁體中文: zh_tw
* [x] 簡體中文: zh
* [x] 繁体中文: zh_tw
* [x] 简体中文: zh
* [x] 日文 (ChatGPT): ja
* [x] 支援使用 config 檔案設定。將 `config.json` 放置於相同使用環境下即可實現局域設定。若要實現全局設定,則將 `config.json` 放置於如下位置
* [x] 支持使用 config 文件设置。将 `config.json` 放置于相同使用环境下即可实现局域设置。若要实现全局设置,则将 `config.json` 放置于如下位置
* Windows: `%localappdata%\Jim137\paifulogger\config.json`
* macOS: `/Users/{UserName}/Library/Application Support/paifulogger/config.json`
* Linux: `~/.local/share/paifulogger/config.json`
## 牌譜紀錄訊息

* 對局時間
* 順位
* 牌譜網址 (方便未來新增新功能時能快速套用過去牌譜)
* 對局前R值
* R值變化量
## 牌谱记录信息

* 对局时间
* 顺位
* 牌谱网址 (方便未来新增新功能时能快速套用过去牌谱)
* 对局前R值
* R值变化量

## 预计新增功能

* [ ] 每一本场的对局回放(html)
* [ ] 和铳分析
* [ ] 雀魂牌谱支持
* [ ] 图形用户界面(GUI)

## 預計新增功能
## 做出贡献

* [ ] 每一本場的對局回放(html)
* [ ] 和銃分析
* [ ] 雀魂牌譜支援
* [ ] 圖形使用者介面(GUI)
我们欢迎各种贡献,包括但不限于报告bug、PR、功能请求、文件改进、本地化...等。

## 做出貢獻
我們歡迎各種貢獻,包括但不限於回報bug、PR、功能要求、文件改進、本地化...等。
参见[CONTRIBUTING.md](https://github.com/Jim137/Tenhou-Paifu-Logger/blob/master/CONTRIBUTING.md)获取更多信息。

參見[CONTRIBUTING.md](https://github.com/Jim137/Tenhou-Paifu-Logger/blob/master/CONTRIBUTING.md)取得更多訊息。
## 授权

## 授權
[MIT](LICENSE)
[MIT](LICENSE)
86 changes: 86 additions & 0 deletions READMEs/README_zh_TW.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# 天鳳牌譜記錄器

[![build](https://github.com/Jim137/Tenhou-Paifu-Logger/actions/workflows/publish-to-test-pypi.yml/badge.svg)](https://github.com/Jim137/Tenhou-Paifu-Logger/actions/workflows/publish-to-test-pypi.yml)
[![lint](https://github.com/Jim137/Tenhou-Paifu-Logger/actions/workflows/test.yml/badge.svg)](https://github.com/Jim137/Tenhou-Paifu-Logger/actions/workflows/test.yml)
[<img src="https://img.shields.io/pypi/v/PaifuLogger?style=plastic"> <img src="https://img.shields.io/pypi/wheel/PaifuLogger?style=plastic">](https://pypi.org/project/PaifuLogger/)
[![Downloads](https://static.pepy.tech/badge/Paifulogger)](https://pepy.tech/project/Paifulogger)
[<img src="https://img.shields.io/github/stars/Jim137/Tenhou-Paifu-Logger?style=plastic">](https://github.com/Jim137/Tenhou-Paifu-Logger/)
[<img src="https://img.shields.io/github/downloads/Jim137/Tenhou-Paifu-Logger/total?style=plastic">](https://github.com/Jim137/Tenhou-Paifu-Logger/releases)
![support-version](https://img.shields.io/pypi/pyversions/PaifuLogger?style=plastic)
![platform](https://img.shields.io/badge/platform-Windows%20%7C%20macOS%20%7C%20Linux-lightgray?style=plastic)
![License](https://img.shields.io/github/license/Jim137/Tenhou-Paifu-Logger?style=plastic)

快速記錄天鳳牌譜的工具。

![Generated by DALL·E](https://github.com/Jim137/Tenhou-Paifu-Logger/raw/master/READMEs/image/paifulogger.png)

如果你喜歡這個專案,請給我一顆star,這將會是我很大的鼓勵。如果你有任何建議,歡迎開issue來討論。

[下載](https://github.com/Jim137/Tenhou-Paifu-Logger/releases/latest) | [English](https://github.com/Jim137/Tenhou-Paifu-Logger/blob/master/README.md) | [简体中文](https://github.com/Jim137/Tenhou-Paifu-Logger/blob/master/READMEs/README_zh.md) | [日本語](https://github.com/Jim137/Tenhou-Paifu-Logger/blob/master/READMEs/README_ja.md)
## 使用方法

1. Clone此專案或下載[最新版本](https://github.com/Jim137/Tenhou-Paifu-Logger/releases/latest)或使用pip下載。

```shell
git clone https://github.com/Jim137/Tenhou-Paifu-Logger.git
```
```shell
pip install PaifuLogger
```

2. 首次使用時,右鍵編輯 `runlog-user.bat` (Linux用戶則 `runlog-user.sh` ),在set LANG= (export LANG=)後加上語言代碼 `zh_tw`,保存後運行此檔案。
使用pip則運行以下命令。

```shell
plog -l zh_tw -o <輸出目錄> <多個牌譜網址>
```
```shell
paifu plog -l zh_tw -o <輸出目錄> <多個牌譜網址>
```

3. 複製天鳳牌譜至剪貼簿。
4. 在出現![1675260159266](image/README_zh/1675260159266.png)後,貼上天鳳牌譜並按下Enter。\
注意:在最新版本中,你可以一次輸入多個牌譜網址,用任何你喜歡的符號隔開即可。如果你很懶,你也可以直接貼上,不用加任何符號。
5. 當出現![1675260331020](image/README_zh/1675260331020.png)後,則表示牌譜已經成功記錄。
6. 當再次出現![1675260159266](image/README_zh/1675260159266.png),即可輸入下個牌譜。

## 功能
* [x] 支援一次輸入多個牌譜網址。
* [x] 將牌譜記錄到csv、Excel或html檔案中。
* [x] 支援一次輸出多個格式。(例:-f csv -f html; -a, --all-formats)
* [x] 區分三麻和四麻,並分別記錄到不同的檔案中。
* [x] 跳過已記錄過的牌譜。
* [x] 重製已記錄過的牌譜(-r, --remake)。當我們更新了牌譜記錄的內容時,這個功能將會很有用。
* [x] 指定輸出目錄(-o, --output)
* [x] 支援mjai牌譜輸出(--mjai)。*首次需要先執行 `git pull --recurse-submodules`*
* [x] 本地化支援(-l, --language)
* [x] 英文: en
* [x] 繁體中文: zh_tw
* [x] 簡體中文: zh
* [x] 日文 (ChatGPT): ja
* [x] 支援使用 config 檔案設定。將 `config.json` 放置於相同使用環境下即可實現局域設定。若要實現全局設定,則將 `config.json` 放置於如下位置:
* Windows: `%localappdata%\Jim137\paifulogger\config.json`
* macOS: `/Users/{UserName}/Library/Application Support/paifulogger/config.json`
* Linux: `~/.local/share/paifulogger/config.json`
## 牌譜紀錄訊息

* 對局時間
* 順位
* 牌譜網址 (方便未來新增新功能時能快速套用過去牌譜)
* 對局前R值
* R值變化量

## 預計新增功能

* [ ] 每一本場的對局回放(html)
* [ ] 和銃分析
* [ ] 雀魂牌譜支援
* [ ] 圖形使用者介面(GUI)

## 做出貢獻
我們歡迎各種貢獻,包括但不限於回報bug、PR、功能要求、文件改進、本地化...等。

參見[CONTRIBUTING.md](https://github.com/Jim137/Tenhou-Paifu-Logger/blob/master/CONTRIBUTING.md)取得更多訊息。

## 授權
[MIT](LICENSE)
9 changes: 6 additions & 3 deletions paifulogger/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,24 @@
main_path = os.path.dirname(os.path.abspath(__file__))
del os

from .version import __version__

from .log import config_path, log, log_paifu, log_parser, remove_old_paifu
from .paifu_dl import paifu_dl
from .src.get_paifu import get_paifu
from .src.get_paifu import get_paifu, get_paifu_from_client_log, get_paifu_from_local
from .src.i18n import localized_str
from .version import __version__

__all__ = [
"__version__",
"config_path",
"get_paifu",
"get_paifu_from_client_log",
"get_paifu_from_local",
"localized_str",
"log",
"log_paifu",
"log_parser",
"main_path",
"remove_old_paifu",
"paifu_dl",
"__version__",
]
24 changes: 17 additions & 7 deletions paifulogger/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,38 @@

from paifulogger.log import main as plog_main
from paifulogger.paifu_dl import main as pdl_main
from paifulogger.version import __version__


def main():
parser = argparse.ArgumentParser(description="PaifuLogger CLI")
parser = argparse.ArgumentParser(description="PaifuLogger CLI", prog="PaifuLogger")
parser.add_argument(
"-v",
"--version",
action="version",
help="""Show version of the program.
If this is used, all other arguments will be ignored and the program will be closed.""",
version=f"%(prog)s {__version__}",
)
subparsers = parser.add_subparsers(required=False, dest="command")

plog_parser = subparsers.add_parser("plog", help="Paifu Logger. See 'paifulogger plog -h' for more info.")
pdl_parser = subparsers.add_parser("pdl", help="Paifu Downloader. See 'paifulogger pdl -h' for more info.")
plog_parser = subparsers.add_parser(
"plog", help="Paifu Logger. See 'paifulogger plog -h' for more info."
)
pdl_parser = subparsers.add_parser(
"pdl", help="Paifu Downloader. See 'paifulogger pdl -h' for more info."
)

options = sys.argv

if "plog" in options:
sys.exit(plog_main(plog_parser))
elif "pdl" in options:
sys.exit(pdl_main(pdl_parser))
elif "-v" in options or "--version" in options:
from .version import __version__
print("Tenhou-Paifu-Logger", __version__)
return 0
else:
parser.parse_args()
sys.exit(parser.print_help())


if __name__ == "__main__":
main()
Loading

0 comments on commit c4d0a31

Please sign in to comment.