Skip to content

Commit

Permalink
Merge branch 'master' into for-dist
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim137 committed Apr 13, 2024
2 parents 568fe82 + cda3f90 commit 0203138
Show file tree
Hide file tree
Showing 36 changed files with 977 additions and 268 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ jobs:
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --per-file-ignores="paifulogger/log.py:C901,F401,F403,F405,E501 paifulogger/src/__init__.py:F401 test/test.py:E402" --exclude mjlog2mjai
- name: Test with test
run: python ./test/test.py
run: python -m unittest
36 changes: 36 additions & 0 deletions .github/workflows/to-pub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: build

on:
push:
branches:
- toPub

jobs:
pub_tools:
name: Run pub_tools
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Ceckout to toPub
run: |
git checkout toPub
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run pub_tools
run: |
python ./pub_tools/pub.py
- name: Commit and push
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "Action@Github.com"
git add . || true
git commit -m "Auto version bump" || true
git push -u origin toPub || true
128 changes: 128 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
jim@mail.jim137.eu.org.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Jim137
Copyright (c) 2023-2024 Jim137

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pip install PaifuLogger==0.3.7.1
>>
>> ii. Copy the paifu URL from tenhou.net to clipboard.
>>
>> iii. Open `runlog-user.bat`.
>> iii. Open `runlog-user.bat` or `runlog-user.sh`.
>
> b. Download from pypi.
>
Expand Down Expand Up @@ -79,18 +79,24 @@ Note: In the latest version, you can input multiple URLs at once, separated by w
* [x] Traditional Chinese: zh_tw
* [x] Simplified Chinese: zh
* [x] Japanese (ChatGPT): ja
* [x] Support config file. Placing `config.json` in the same directory as the execution enables local configuration. For global configuration, place it in the following directories:
* Windows: `%localappdata%\Jim137\paifulogger\config.json`
* macOS: `/Users/{UserName}/Library/Application Support/paifulogger/config.json`
* Linux: `~/.local/share/paifulogger/config.json`

## Information logged

* Game time
* Placing
* URL (for future use)
* Rate before the game
* The change of Rate: Note it assumes that the player has played more than 400 games.
* Number of wins
* Number of deal-ins

## Future features

* [ ] Add match replay for every round in html file
* [ ] The change of Rate
* [ ] Agari analysis
* [ ] Support Majsoul paifu
* [ ] GUI
Expand Down
8 changes: 7 additions & 1 deletion READMEs/README_ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,24 @@ CSV、ExcelまたはHTMLファイルに天鳳の牌譜をいくつかの主要
* [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`

## 記録される情報

* ゲームの時間
* 順位
* URL (将来のために)
* ゲーム前のレート
* レート変化
* 和了数
* 放銃数

## 将来の機能

* [ ] 各ラウンドの試合リプレイをHTMLファイルに追加
* [ ] レートの変動
* [ ] 和了解析
* [ ] Majsoul牌譜のサポート
* [ ] GUI
Expand Down
7 changes: 5 additions & 2 deletions READMEs/README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,21 @@
* [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)
* [ ] 對局R值變化
* [ ] 和銃分析
* [ ] 雀魂牌譜支援
* [ ] 圖形使用者介面(GUI)
Expand Down
3 changes: 3 additions & 0 deletions doc/example_output/Paifu.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# id,Date,Placing,Paifu,Rate before match,Change of rate,Round number,Win num,Deal-in num
0,2023-05-11 23:00:00,1,https://tenhou.net/0/?log=2023051123gm-0001-0000-b3720f99&tw=2,1533.7,6.216312500000001,3,2,0
1,2023-05-12 16:00:00,1,https://tenhou.net/0/?log=2023051216gm-0001-0000-5fd022cc&tw=1,1559.23,5.8228125,2,1,0
93 changes: 93 additions & 0 deletions doc/example_output/Paifu.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<!DOCTYPE html>
<html lang=en>
<head>
<meta charset="utf-8">
<title>Paifu</title>
<style>
table {
border-collapse: collapse;
}
table, th, td {
border: 1px solid black;
}
th, td {
padding: 5px;
}
th {
text-align: left;
}
</style>
<script>
if (window.localStorage) {
var p = document.querySelector('#persisted-text');
if (localStorage.text == null) {
localStorage.text = p.value;
} else {
p.value = localStorage.text;
}
p.addEventListener('keyup', function(){ localStorage.text = p.value; }, false);
}
</script>
</head>
<body>
<table style="width:100%">
<thead>
<tr>
<th>Date</th>
<th>Placing</th>
<th>Paifu</th>
<th>Remark</th>
<th>Rate before match</th>
<th>Change of rate</th>
<th>Round number</th>
<th>Win num</th>
<th>Deal-in num</th>
</tr>
</thead>
<tbody>

<tr>
<td>2022-05-25 01:00:00</td>
<td>1</td>
<td><a href="https://tenhou.net/3/?log=2022052501gm-00c1-0000-f71e7910&tw=1">https://tenhou.net/3/?log=2022052501gm-00c1-0000-f71e7910&tw=1</a></td>
<td><textarea id="persisted-text"></textarea></td>
<td>1613.00</td>
<td>6.413</td>
<td>4</td>
<td>1</td>
<td>1</td>
</tr>


<tr>
<td>2023-05-11 23:00:00</td>
<td>1</td>
<td><a href="https://tenhou.net/0/?log=2023051123gm-0001-0000-b3720f99&tw=2">https://tenhou.net/0/?log=2023051123gm-0001-0000-b3720f99&tw=2</a></td>
<td><textarea id="persisted-text"></textarea></td>
<td>1533.70</td>
<td>6.216</td>
<td>3</td>
<td>2</td>
<td>0</td>
</tr>


<tr>
<td>2023-05-12 16:00:00</td>
<td>1</td>
<td><a href="https://tenhou.net/0/?log=2023051216gm-0001-0000-5fd022cc&tw=1">https://tenhou.net/0/?log=2023051216gm-0001-0000-5fd022cc&tw=1</a></td>
<td><textarea id="persisted-text"></textarea></td>
<td>1559.23</td>
<td>5.823</td>
<td>2</td>
<td>1</td>
<td>0</td>
</tr>

</tbody>
</table>
<p>Total games logged = 2</p>
<p>Average Placing = 1.0</p>
<p>Win rate = 44.444%</p>
<p>Deal-in rate = 11.111%</p>
</body></html>
Binary file added doc/example_output/Paifu.xlsx
Binary file not shown.
2 changes: 2 additions & 0 deletions doc/example_output/SanmaPaifu.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# id,Date,Placing,Paifu,Rate before match,Change of rate,Round number,Win num,Deal-in num
0,2023-05-04 19:00:00,2,https://tenhou.net/0/?log=2023050419gm-0099-0000-b3111c7e&tw=0,1657.02,2.396216666666667,8,4,2
Loading

0 comments on commit 0203138

Please sign in to comment.