Metadata-Version: 2.4
Name: kindle-anki
Version: 1.0.1
Summary: A lightweight E-Ink optimized Anki web server for Kindle Experimental Browser
Author: sh1ragami
License-Expression: MIT
Project-URL: Homepage, https://github.com/sh1ragami/kindle-anki
Keywords: anki,kindle,e-ink,ankiconnect,flashcards,study
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Topic :: Education
Classifier: Topic :: Utilities
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# kindle-anki

[![PyPI version](https://img.shields.io/pypi/v/kindle-anki.svg?color=blue)](https://pypi.org/project/kindle-anki/)
[![Python Version](https://img.shields.io/badge/python-3.8%2B-blue)](https://www.python.org/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

<img src="https://github.com/user-attachments/assets/9dd29420-ff20-425f-9f84-8efab7e6fa87" width="300" alt="IMG_20260827_040355500" /> <img src="https://github.com/user-attachments/assets/fd662261-c642-40df-91ea-a726faa86ee2" width="300" alt="IMG_20260827_040624468" /> 


KindleのブラウザでAnkiカードを快適に学習・復習するための軽量ローカルWebサーバーです。

- **E-ink最適化**: 不要な枠線やHTMLタグを排除し、白黒反転フラッシュなし（AJAX）で単語・発音・意味・例文を表示
- **PC音声再生同期**: カード表示に合わせてホストPC側で音声再生

---

## 📦 インストール (Installation)

PyPIから直接インストールできます:

```bash
pip install kindle-anki
```

または `pipx` を使用:

```bash
pipx install kindle-anki
```

あるいはリポジトリから実行:

```bash
git clone https://github.com/sh1ragami/kindle-anki.git
cd kindle-anki
python3 kindle_anki.py
```

---

## ⚙️ 前提条件 (Prerequisites)

1. PC上で **Anki** が起動していること。
2. アドオン **AnkiConnect** (`2055492159`) がインストールされていること。
3. AnkiConnectの設定で `webBindAddress` を `"0.0.0.0"` に変更すること（Ankiメニュー -> ツール -> アドオン -> AnkiConnect -> 設定）。

```json
{
    "webBindAddress": "0.0.0.0",
    "webBindPort": 8765
}
```

---

## 🚀 使い方 (Usage)

### 1. サーバーの起動

`pip` でインストールした場合:

```bash
kindle-anki
```

スクリプトから直接起動する場合:

```bash
python3 kindle_anki.py
```

起動時に表示されるURL（例: `http://192.168.1.10:8000`）を確認します。

### 2. Kindleからアクセス

1. KindleをPCと同じWi-Fiに接続します。
2. Kindleの「体験版ブラウザ」を開き、表示されたURLにアクセスします。

---

## 🔧 オプション (Options)

```bash
kindle-anki --port 8000 --host 0.0.0.0 --anki-url http://127.0.0.1:8765
```

| オプション | デフォルト | 説明 |
| :--- | :--- | :--- |
| `--port` | `8000` | サーバーのポート番号 |
| `--host` | `0.0.0.0` | バインドするホストIP |
| `--anki-url` | `http://127.0.0.1:8765` | AnkiConnectのURL |

---

## 🔊 音声再生 (Audio)

PC側に `mpv` または `ffplay` がインストールされている場合、Kindleのカード切り替えに合わせて自動でPCスピーカーから音声が流れます。

```bash
# Ubuntu / Debian
sudo apt install mpv

# macOS
brew install mpv
```

---

## 📄 ライセンス (License)

[MIT License](LICENSE)
