Skip to content

Commit

Permalink
update version
Browse files Browse the repository at this point in the history
  • Loading branch information
whyliam committed May 5, 2015
1 parent c758a4f commit d75a23f
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 3 deletions.
21 changes: 21 additions & 0 deletions License
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# whyliam.workflows.youdao
---

有道翻译 workflow v1.0.0

默认快捷键 "cd",多个翻译结果,回车 即可以在有道词典的页面中查询输入的单词。


### [下载](https://github.com/samqiu/Youdao.alfredworkflow/blob/master/Youdao.alfredworkflow)

## Demo

![](http://ww1.sinaimg.cn/large/48910e01gw1ertn14ua8bg213m0khx5t.gif)

---

## The MIT License (MIT)

Copyright (c) 2015 [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Binary file modified icon_web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.0
14 changes: 11 additions & 3 deletions youdao.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
ICON_BASIC = 'icon_basic.png'
ICON_WEB = 'icon_web.png'


def get_web_data(query):
query = urllib.quote(query)
query = urllib.quote(str(query))
url = 'http://fanyi.youdao.com/openapi.do?keyfrom=' + keyfrom + \
'&key=' + str(apikey) + \
'&type=data&doctype=json&version=1.1&q=' + query
Expand All @@ -32,6 +33,7 @@ def main(wf):
return 0

s = get_web_data(query)

# '翻译结果'
title = s["translation"]
title = ''.join(title).encode("UTF-8")
Expand All @@ -40,7 +42,7 @@ def main(wf):
if title != query:
subtitle = '翻译结果'
wf.add_item(
title=title, subtitle=subtitle, arg=url, valid=True, icon=ICON_DEFAULT)
title=title, subtitle=subtitle, arg=url, valid=True, icon=ICON_DEFAULT)

# '简明释意'
if u'basic' in s.keys():
Expand Down Expand Up @@ -68,5 +70,11 @@ def main(wf):
wf.send_feedback()

if __name__ == '__main__':
wf = Workflow()
wf = Workflow(update_settings={
'github_slug': 'liszd/whyliam.workflows.youdao',
'frequency': 7
})

sys.exit(wf.run(main))
if wf.update_available:
wf.start_update()

0 comments on commit d75a23f

Please sign in to comment.