diff --git a/Makefile b/Makefile index fd8049d..c75f5f0 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/README.md b/README.md index 1746785..7b932b4 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 @@ -103,7 +108,7 @@ Flags: ydict ``` -2. Query with speech (__Available for MacOS & Linux__) +2. Query with speech ```text ydict -v 1 diff --git a/README_CN.md b/README_CN.md index 2820260..2a76a15 100644 --- a/README_CN.md +++ b/README_CN.md @@ -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 @@ -98,7 +104,7 @@ Flags: ydict <要查询的单词或词组> ``` -2. 查询并朗读单词 (__目前仅支持 MacOS 和 Linux__) +2. 查询并朗读单词 ```text ydict -v <要查询的单词或词组> diff --git a/lib/utils.go b/lib/utils.go index 8588e83..815a831 100644 --- a/lib/utils.go +++ b/lib/utils.go @@ -57,6 +57,8 @@ func IsAvailableOS() bool { return true case "linux": return true + case "windows": + return true } return false } diff --git a/win-deps/bass.dll b/win-deps/bass.dll new file mode 100644 index 0000000..e29f943 Binary files /dev/null and b/win-deps/bass.dll differ diff --git a/win-deps/mpg123.exe b/win-deps/mpg123.exe new file mode 100644 index 0000000..bc3f078 Binary files /dev/null and b/win-deps/mpg123.exe differ