Skip to content

Commit

Permalink
Windows 下语音朗读支持 (#24)
Browse files Browse the repository at this point in the history
* add windows speech support

* add win-deps
  • Loading branch information
ycrao authored Dec 12, 2020
1 parent 3ecb1e7 commit bd31641
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ release:
# Build for win
go clean
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 GO111MODULE=on go build -ldflags "-s -w -X main.Version=${VERSION}"
tar czvf ${BINARY}-win64-${VERSION}.tar.gz ./${BINARY}.exe
tar czvf ${BINARY}-win64-${VERSION}.tar.gz ./${BINARY}.exe ./win-deps/bass.dll ./win-deps/mpg123.exe
go clean
# Cleans our projects: deletes binaries
clean:
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ go get github.com/TimothyYe/ydict

#### Manual Installation

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

#### Integrate with Vim

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

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

___NOTICE:___ Currently, speech feature is only available for MacOS/Linux.
#### Windows x64

> Speech Adaptation by [ycrao](https://github.com/ycrao/learning_golang/tree/main/cmd-bass-player) under `Windows` OS.
- 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` ) .
- 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 .

#### Mac OS

Expand Down Expand Up @@ -103,7 +108,7 @@ Flags:
ydict <word(s) to query>
```

2. Query with speech (__Available for MacOS & Linux__)
2. Query with speech

```text
ydict -v 1 <word(s) to query>
Expand Down
10 changes: 8 additions & 2 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ go get github.com/TimothyYe/ydict

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

___注意:___ 语音朗读功能当前仅支持操作系统 MacOS/Linux。
#### Windows x64

> `Windows` 下语音朗读适配方案由 [ycrao](https://github.com/ycrao/learning_golang/tree/main/cmd-bass-player) 提供。
- 拷贝 `bass.dll``mpg123.exe` (也可同 `ydict.exe`) 文件一起 到 Windows 系统目录 (如 `C:\Windows\``C:\Windows\System32`)。
- 或者拷贝 `bass.dll``mpg123.exe` (也可同 `ydict.exe`) 文件一起文件到某一特定目录下,然后添加该目录路径到 `PATH` 系统环境变量中。


#### Mac OS

Expand Down Expand Up @@ -98,7 +104,7 @@ Flags:
ydict <要查询的单词或词组>
```

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

```text
ydict -v <要查询的单词或词组>
Expand Down
2 changes: 2 additions & 0 deletions lib/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ func IsAvailableOS() bool {
return true
case "linux":
return true
case "windows":
return true
}
return false
}
Expand Down
Binary file added win-deps/bass.dll
Binary file not shown.
Binary file added win-deps/mpg123.exe
Binary file not shown.

0 comments on commit bd31641

Please sign in to comment.