Skip to content

Commit bd31641

Browse files
authored
Windows 下语音朗读支持 (#24)
* add windows speech support * add win-deps
1 parent 3ecb1e7 commit bd31641

File tree

6 files changed

+19
-6
lines changed

6 files changed

+19
-6
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ release:
2525
# Build for win
2626
go clean
2727
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 GO111MODULE=on go build -ldflags "-s -w -X main.Version=${VERSION}"
28-
tar czvf ${BINARY}-win64-${VERSION}.tar.gz ./${BINARY}.exe
28+
tar czvf ${BINARY}-win64-${VERSION}.tar.gz ./${BINARY}.exe ./win-deps/bass.dll ./win-deps/mpg123.exe
2929
go clean
3030
# Cleans our projects: deletes binaries
3131
clean:

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ go get github.com/TimothyYe/ydict
5050

5151
#### Manual Installation
5252

53-
Download it from [releases](https://github.com/TimothyYe/ydict/releases), and extact it to /usr/bin.
53+
Download it from [releases](https://github.com/TimothyYe/ydict/releases), and extract it to /usr/bin.
5454

5555
#### Integrate with Vim
5656

@@ -60,7 +60,12 @@ To query words from Vim, you need another Vim plugin: [vim-ydict](https://github
6060

6161
Starting from V0.9, speech feature is available. You need to install mpg123 to enable this feature.
6262

63-
___NOTICE:___ Currently, speech feature is only available for MacOS/Linux.
63+
#### Windows x64
64+
65+
> Speech Adaptation by [ycrao](https://github.com/ycrao/learning_golang/tree/main/cmd-bass-player) under `Windows` OS.
66+
67+
- Just copy `bass.dll` and `mpg123.exe` (can also with `ydict.exe`) file to `Windows` system path (such as `C:\Windows\` or `C:\Windows\System32` ) .
68+
- Or copy `bass.dll` and `mpg123.exe` (can also with `ydict.exe`) file to somewhere in the same directory, and setting that directory in `PATH` System Environment Variables .
6469

6570
#### Mac OS
6671

@@ -103,7 +108,7 @@ Flags:
103108
ydict <word(s) to query>
104109
```
105110

106-
2. Query with speech (__Available for MacOS & Linux__)
111+
2. Query with speech
107112

108113
```text
109114
ydict -v 1 <word(s) to query>

README_CN.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,13 @@ go get github.com/TimothyYe/ydict
5656

5757
从V0.9版本开始,提供语音朗读功能。为开启此功能,你需要先安装mpg123组件。
5858

59-
___注意:___ 语音朗读功能当前仅支持操作系统 MacOS/Linux。
59+
#### Windows x64
60+
61+
> `Windows` 下语音朗读适配方案由 [ycrao](https://github.com/ycrao/learning_golang/tree/main/cmd-bass-player) 提供。
62+
63+
- 拷贝 `bass.dll``mpg123.exe` (也可同 `ydict.exe`) 文件一起 到 Windows 系统目录 (如 `C:\Windows\``C:\Windows\System32`)。
64+
- 或者拷贝 `bass.dll``mpg123.exe` (也可同 `ydict.exe`) 文件一起文件到某一特定目录下,然后添加该目录路径到 `PATH` 系统环境变量中。
65+
6066

6167
#### Mac OS
6268

@@ -98,7 +104,7 @@ Flags:
98104
ydict <要查询的单词或词组>
99105
```
100106

101-
2. 查询并朗读单词 (__目前仅支持 MacOS 和 Linux__)
107+
2. 查询并朗读单词
102108

103109
```text
104110
ydict -v <要查询的单词或词组>

lib/utils.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ func IsAvailableOS() bool {
5757
return true
5858
case "linux":
5959
return true
60+
case "windows":
61+
return true
6062
}
6163
return false
6264
}

win-deps/bass.dll

241 KB
Binary file not shown.

win-deps/mpg123.exe

556 KB
Binary file not shown.

0 commit comments

Comments
 (0)