-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
liszd
committed
Apr 15, 2017
1 parent
a36dd39
commit b456aa6
Showing
13 changed files
with
289 additions
and
147 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# whyliam.workflows.youdao | ||
|
||
## 有道翻译 workflow v1.2.5 | ||
## 有道翻译 workflow v2.0.0 | ||
|
||
默认快捷键 "yd",查看翻译结果。 | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,40 @@ | ||
# -*- coding: utf-8 -*- | ||
import sys | ||
import os | ||
from workflow import Workflow | ||
from workflow import Workflow3 | ||
|
||
reload(sys) | ||
sys.setdefaultencoding('utf8') | ||
|
||
|
||
def getargs(wf): | ||
query = sys.argv[1] | ||
query = query.split('$') | ||
query = query.split('$%') | ||
part = int(sys.argv[2]) | ||
|
||
if part == 1: | ||
if query[4]: | ||
import webbrowser | ||
new = 2 | ||
url = "https://blog.naaln.com/2017/04/alfred-youdao-intro/" | ||
webbrowser.open(url, new=new) | ||
return 0 | ||
|
||
if part == 0: | ||
# 查询的单词 | ||
sys.stdout.write(query[0].strip()) | ||
elif part == 1: | ||
# 翻过的结果 | ||
sys.stdout.write(query[1].strip()) | ||
elif part == 2: | ||
# 发音 | ||
if query[2]: | ||
bashCommand = "say --voice='Samantha' " + query[2] | ||
os.system(bashCommand) | ||
if query[3]: | ||
bashCommand = "say --voice='Ting-Ting' " + query[3] | ||
os.system(bashCommand) | ||
return 0 | ||
|
||
|
||
if __name__ == '__main__': | ||
wf = Workflow() | ||
wf = Workflow3() | ||
sys.exit(wf.run(getargs)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.2.4 | ||
2.0.0 |
Binary file not shown.
Oops, something went wrong.