earshot-cli 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- earshot/__init__.py +7 -0
- earshot/capture.py +148 -0
- earshot/cli.py +545 -0
- earshot/compose.py +195 -0
- earshot/config.py +88 -0
- earshot/deliver.py +219 -0
- earshot/extract.py +88 -0
- earshot/live.py +76 -0
- earshot/models.py +72 -0
- earshot/subtitle.py +207 -0
- earshot/transcribe.py +220 -0
- earshot/transcribe_cloud.py +76 -0
- earshot_cli-0.1.0.dist-info/METADATA +140 -0
- earshot_cli-0.1.0.dist-info/RECORD +17 -0
- earshot_cli-0.1.0.dist-info/WHEEL +4 -0
- earshot_cli-0.1.0.dist-info/entry_points.txt +2 -0
- earshot_cli-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: earshot-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: 旁听剪藏:跨平台桌面端系统声录制 → 本地转写 → 投递知识库(默认 ExoMind,可插拔)
|
|
5
|
+
Project-URL: Homepage, https://github.com/helloworldtang/earshot
|
|
6
|
+
Project-URL: Repository, https://github.com/helloworldtang/earshot
|
|
7
|
+
Project-URL: Issues, https://github.com/helloworldtang/earshot/issues
|
|
8
|
+
Author: Jackie
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: asr,bilibili,cli,knowledge-base,sensevoice,subtitle,transcription
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Natural Language :: Chinese (Simplified)
|
|
16
|
+
Classifier: Operating System :: MacOS
|
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
|
|
22
|
+
Classifier: Topic :: Utilities
|
|
23
|
+
Requires-Python: >=3.12
|
|
24
|
+
Requires-Dist: httpx>=0.27
|
|
25
|
+
Requires-Dist: imageio-ffmpeg>=0.5
|
|
26
|
+
Requires-Dist: numpy>=1.26
|
|
27
|
+
Requires-Dist: onnxruntime<1.29,>=1.28.0
|
|
28
|
+
Requires-Dist: sherpa-onnx>=1.13.8
|
|
29
|
+
Requires-Dist: soundcard>=0.4.3
|
|
30
|
+
Requires-Dist: soxr>=0.5
|
|
31
|
+
Requires-Dist: yt-dlp>=2025.1
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# earshot
|
|
35
|
+
|
|
36
|
+
旁听剪藏:**听到的,都能进知识库。**
|
|
37
|
+
|
|
38
|
+
听 B站/视频号/播客/讲座时开着它,听完 `Ctrl-C`,录音自动转写为 Markdown 并投递到你的知识库(默认 [ExoMind 知识飞轮](https://exomind.ai-as.cn),可插拔任意 webhook)。纯端侧转写,无限流、零 API 费用。
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
系统声音 ──录制──> 16k wav ──silero VAD 切段──> SenseVoice 端侧识别(实时字幕) ──> Markdown ──> 投递(exomind / webhook / 仅存档)
|
|
42
|
+
视频链接 ──yt-dlp──> 平台字幕(ai-zh/CC) ────────────────────────────┘(高信噪比路线)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## 安装(开箱即用)
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
uv tool install earshot-cli # 或 pipx install earshot-cli;安装后命令名是 earshot
|
|
49
|
+
earshot doctor # 环境自检
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
源码安装请**锁版本 tag**,不要引滚动的 `main`(消费方 `uv sync`/`pip install` 会隐性升级到未审阅代码;升级应当是显式改版本号的决策):
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
uv tool install "earshot-cli @ https://github.com/helloworldtang/earshot/archive/refs/tags/v0.1.0.tar.gz"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
- **零系统依赖**:ffmpeg 已随 Python wheel 内置([imageio-ffmpeg](https://pypi.org/project/imageio-ffmpeg),MoviePy 同款),无需 brew/apt。
|
|
59
|
+
- **模型首次运行自动下载**:SenseVoice int8 + silero VAD(~230MB,默认走 hf-mirror,`HF_ENDPOINT` 可覆盖),装完不再下。
|
|
60
|
+
- **投递免装 CLI**:默认直连 ExoMind HTTP API(复用 `~/.exomind/config.json` 凭据);没有凭据但有 exomind CLI 时自动回退;也支持任意 webhook。
|
|
61
|
+
|
|
62
|
+
### 平台采集矩阵
|
|
63
|
+
|
|
64
|
+
| 平台 | 系统声采集 | 额外步骤 |
|
|
65
|
+
|---|---|---|
|
|
66
|
+
| Windows | WASAPI loopback(原生) | 无 |
|
|
67
|
+
| Linux | PulseAudio/PipeWire `.monitor` | 无 |
|
|
68
|
+
| macOS | 无原生环回 | 见下方「macOS 三级台阶」,零配置即可用 |
|
|
69
|
+
|
|
70
|
+
#### macOS 三级台阶(按门槛从低到高)
|
|
71
|
+
|
|
72
|
+
1. **零配置·录屏路线**:听 Mac 上的内容时 `Cmd+Shift+5` 录屏(自带系统声),
|
|
73
|
+
听完 `earshot audio 录屏.mp4` —— 不装任何东西,今天就能用。
|
|
74
|
+
2. **零配置·麦录兜底**:直接 `earshot listen`,未配置环回时自动退回内置麦克风
|
|
75
|
+
外放收音(豆包同款,音质一般但可用)。
|
|
76
|
+
3. **一次性设置·内录(音质无损)**:`brew install blackhole-2ch`,在「音频 MIDI 设置」
|
|
77
|
+
新建**多输出设备**(BlackHole 2ch + 扬声器)并设为系统输出 —— 边听边录,终身受用。
|
|
78
|
+
装好后 earshot 自动选中,无需 `--device`。
|
|
79
|
+
|
|
80
|
+
> macOS 下默认逻辑 = 取「当前默认扬声器的同名输入设备」;把多输出设备设为默认输出即可被自动选中。也可 `--device` 指定。
|
|
81
|
+
|
|
82
|
+
## 使用
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# 旁听模式:开录 → 听(实时字幕滚动) → Ctrl-C 完成 → 预览确认 → 投递
|
|
86
|
+
earshot listen
|
|
87
|
+
earshot listen --note "B站·xxx第3期"
|
|
88
|
+
|
|
89
|
+
# B站等视频链接直拉字幕(高信噪比:无环境噪音/打断;AI 字幕需登录态)
|
|
90
|
+
earshot video "https://www.bilibili.com/video/BVxxxx" --cookies-from-browser chrome
|
|
91
|
+
|
|
92
|
+
# 已有音视频文件(录屏 mp4 / 语音 m4a / 播客 mp3)
|
|
93
|
+
earshot audio recording.mp4 --title "通勤听书笔记" --deliver none
|
|
94
|
+
|
|
95
|
+
# 补投/重投 outbox 里的笔记(如环境问题当时没投出去)
|
|
96
|
+
earshot deliver ~/.earshot/outbox/20261030-xxxx.md
|
|
97
|
+
|
|
98
|
+
# 列出采集设备 / 环境自检 / 清理过期留档
|
|
99
|
+
earshot devices
|
|
100
|
+
earshot doctor
|
|
101
|
+
earshot clean --days 30
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
常用参数:`--title`(默认取首句截断40字)、`--tag`(可多次)、`--note`(来源备注写入脚注)、
|
|
105
|
+
`--engine server`(改走云端 dashscope 转写,复用 `~/.exomind/config.json` 凭据)、
|
|
106
|
+
`--deliver webhook --webhook <url>`(投递到任意知识库,POST JSON `{origin,title,content,tags}`)、
|
|
107
|
+
`--deliver none`(只落 `~/.earshot/outbox/` 存档)。
|
|
108
|
+
|
|
109
|
+
笔记留档:`~/.earshot/outbox/YYYYMMDD-HHMMSS-<标题>.md`。
|
|
110
|
+
|
|
111
|
+
### 文件生命周期
|
|
112
|
+
|
|
113
|
+
| 位置 | 内容 | 生命周期 |
|
|
114
|
+
|---|---|---|
|
|
115
|
+
| `~/.earshot/tmp/*.wav` | 录音中间产物 | 转写投递成功后**自动删除**(失败保留供排查) |
|
|
116
|
+
| `~/.earshot/outbox/*.md` | 转写笔记留档 | **永久保留**(审计/重投兜底),`earshot clean --days 30` 手动清理 |
|
|
117
|
+
|
|
118
|
+
投递前会先在终端**预览识别内容**,回车投递、`q` 放弃(笔记仍留档);`--yes` 跳过确认。等待服务端回执时 Ctrl-C = 不再等待(内容已提交,job 在服务端继续)。
|
|
119
|
+
|
|
120
|
+
## 设计要点
|
|
121
|
+
|
|
122
|
+
- **声音是最后的通用接口**:不依赖任何平台的开放性(B站字幕 API、视频号加密……都不碰),换平台零成本。
|
|
123
|
+
- **端侧优先**:SenseVoice-small int8 纯 CPU 转写,1 小时音频约 1-2 分钟,无"服务用户多请稍后"。
|
|
124
|
+
- **投递可插拔**:exomind CLI(复用其异步 job、轮询、client_key 幂等)/ webhook / 仅存档。
|
|
125
|
+
- **平台差异只允许存在于 `capture.py`**:换采集方案不动上层。
|
|
126
|
+
|
|
127
|
+
## 开发
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
uv sync # 含 dev 组(ruff/mypy/pytest)
|
|
131
|
+
uv run ruff check . && uv run ruff format --check .
|
|
132
|
+
uv run mypy
|
|
133
|
+
uv run pytest
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
测试不依赖模型与声卡;`tests/test_extract.py` 需要本机 ffmpeg(无则自动跳过)。
|
|
137
|
+
|
|
138
|
+
## License
|
|
139
|
+
|
|
140
|
+
MIT
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
earshot/__init__.py,sha256=dshAwdP8P0K825agnvPOw8q9uUrHVCxN4_9WLWwxpGM,249
|
|
2
|
+
earshot/capture.py,sha256=aN7TFuHsePr5sXrLzCmQQj5mtq4MnKmVU6VVpA_j5U0,5312
|
|
3
|
+
earshot/cli.py,sha256=Jwpzv92lAWaTW01J17ojwPfxzn9JyX4c-alTsJELkmY,21860
|
|
4
|
+
earshot/compose.py,sha256=M3POzXazfj3sf-qsqKuMPyMs6zJ873XsN_GHZxIMtI4,6990
|
|
5
|
+
earshot/config.py,sha256=BGlrL_88JjdTBAY6Xx7Myv7hn2Xbg8HrQh6VozBU0J4,2843
|
|
6
|
+
earshot/deliver.py,sha256=mDjhiuEqT-zV1efaIADr1dCZCZEGfKlr0UfpMpCHl3o,8124
|
|
7
|
+
earshot/extract.py,sha256=u7qQychWH6t6WOmRL0SDxfbBM0obN3n7W78mpN72RHU,2293
|
|
8
|
+
earshot/live.py,sha256=uuIBp18byqrmZWBEt1Eh7NOZQSyeijAtL2YmDxL1npg,2813
|
|
9
|
+
earshot/models.py,sha256=WSbGEqsAljeDUcKl9d2A_4YsnMt1WiP04dojnF8DeIM,2727
|
|
10
|
+
earshot/subtitle.py,sha256=1F2e4HANR9Eq3pKgv4ojeaj6cuJruv1zwI519SJehUM,7297
|
|
11
|
+
earshot/transcribe.py,sha256=XZo0Jx_NvbX0GTSlQlPOXLuimPZN-LKmZ3__aUq-rmQ,8476
|
|
12
|
+
earshot/transcribe_cloud.py,sha256=ClhnNi3HLOdthaLabBO2DT_sa2WC-ErrB4v6MqLY2UQ,2612
|
|
13
|
+
earshot_cli-0.1.0.dist-info/METADATA,sha256=GOpJusFrTFvG30rRGSO8KqJAE7B6kztV8U-VXZ3uLFk,6410
|
|
14
|
+
earshot_cli-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
15
|
+
earshot_cli-0.1.0.dist-info/entry_points.txt,sha256=WdD9uwSAx96lwwhSWy99RRC1hNfrpXwpJtv3gusmzw8,45
|
|
16
|
+
earshot_cli-0.1.0.dist-info/licenses/LICENSE,sha256=3bjq9c28MyU9vMH4RKKQTH-RqLyxpcU4ZGwGwLgdTRI,1063
|
|
17
|
+
earshot_cli-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jackie
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|