This repository has been archived by the owner on Jan 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
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
MIKUScallion
authored and
MIKUScallion
committed
Jun 6, 2017
0 parents
commit daa0147
Showing
19 changed files
with
1,797 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
_tmp | ||
lib | ||
*.pyc |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# file GENERATED by distutils, do NOT edit | ||
index.py | ||
main.py | ||
setup.py | ||
utils/__init__.py | ||
utils/cookie_util.py | ||
utils/extract_util.py | ||
utils/page_util.py | ||
vendor/lxml/ElementInclude.py | ||
vendor/lxml/__init__.py | ||
vendor/lxml/_elementpath.py | ||
vendor/lxml/builder.py | ||
vendor/lxml/cssselect.py | ||
vendor/lxml/doctestcompare.py | ||
vendor/lxml/pyclasslookup.py | ||
vendor/lxml/sax.py | ||
vendor/lxml/usedoctest.py |
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Onigiri 饭团日语词典 | ||
|
||
饭团日语词典 是 Alfred 3 的一个 Workflow,用于快速查询日语单词( 日 -> 中 ),查询结果除基本信息外,还包含读音与例句等。 | ||
|
||
## 用法 | ||
|
||
### 完全版 | ||
|
||
在 Alfred 中输入关键词 **onigiri** 或快捷键 **Cmd + O**,空格后加上查询内容,例如: | ||
|
||
``` | ||
onigiri mama | ||
``` | ||
|
||
运行结果为: | ||
|
||
![](./readme_01.png) | ||
|
||
### 简版 | ||
|
||
在 Alfred 中输入关键词 **onigiri_lite** 或 快捷键 **Alt + l**,空格后加上查询内容,例如: | ||
|
||
``` | ||
onigiri_lite mama | ||
``` | ||
|
||
运行结果为: | ||
|
||
![](./readme_02.png) | ||
|
||
### 其他 | ||
|
||
在选择项目上按下 Enter、Ctrl、Alt、Cmd、Cmd + L 与 CMD + L 等,来获得帮助或使用更多功能,尝试一下吧! | ||
|
||
希望,这个小工具能够帮助到和我一样喜欢日语的您,(///▽///) | ||
|
||
### 免责声明 | ||
|
||
* 词典数据来源于 [沪江小D]('http://dict.hjenglish.com/jp/jc'),仅用于个人学习交流使用 | ||
* 在使用过程中,程序会将用户的查询结果缓存起来(本地缓存 + 服务器缓存),但不会上传查词结果之外任何用户数据 | ||
* Dependent on [lxml](http://lxml.de). The lxml library is shipped under a **[BSD license](https://github.com/lxml/lxml/blob/master/doc/licenses/BSD.txt)**. libxml2 and libxslt2 itself are shipped under the **[MIT license](http://www.opensource.org/licenses/mit-license.html)**. There should therefore be no obstacle to using lxml in your codebase. | ||
* <div>Icons made by <a href="http://www.freepik.com" title="Freepik">Freepik</a> from <a href="http://www.flaticon.com" title="Flaticon">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></div> | ||
* Current version 1.1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#!/usr/bin/python | ||
# -*- coding: UTF-8 -*- | ||
|
||
import json | ||
import hashlib | ||
|
||
payload = {} | ||
|
||
def converte (data): | ||
for word in data['2']: | ||
c_word = { | ||
'title': _first(word['0']), | ||
'subtitle': ''.join(word['5']) + '\t' + '%s %d-%d %s' % (_first(word['1']), | ||
word['3'], word['2'], _first(word['4'])), | ||
'audio': _first(word['6']), | ||
'type': {} | ||
} | ||
c_word['uid'] = _hash_json(c_word) | ||
payload[c_word['uid']] = c_word | ||
for btype in word['9']: | ||
for explain in btype['1']: | ||
c_type = { | ||
'title': _first(btype['0']), | ||
'subtitle': _first(explain['0']), | ||
'example': {} | ||
} | ||
c_type['uid'] = _hash_json(c_type) | ||
c_word['type'][c_type['uid']] = c_type | ||
for g_exp in explain['1']: | ||
for exp in g_exp: | ||
c_exp = { | ||
'audio': '' | ||
} | ||
for index in range(0, len(exp)): | ||
if index == 0: | ||
c_exp['title'] = exp[index] | ||
if index == 1: | ||
c_exp['subtitle'] = exp[index] | ||
c_exp['uid'] = _hash_json(c_exp) | ||
c_type['example'][c_exp['uid']] = c_exp | ||
for exp in explain['2']: | ||
c_exp = { | ||
'audio': '' | ||
} | ||
for index in range(0, len(exp)): | ||
if index == 0: | ||
c_exp['title'] = exp[index] | ||
if index == 1: | ||
c_exp['subtitle'] = exp[index] | ||
if index == 2: | ||
c_exp['audio'] = exp[index] | ||
c_exp['uid'] = _hash_json(c_exp) | ||
c_type['example'][c_exp['uid']] = c_exp | ||
|
||
if not payload.keys(): | ||
raise Exception | ||
|
||
return payload | ||
|
||
def _stringify_json (json_data, decode = False): | ||
tmp = json.dumps(json_data) | ||
if decode: | ||
tmp = tmp.decode('unicode-escape') | ||
return tmp | ||
|
||
def _hash_json (json_data): | ||
tmp = _stringify_json(json_data) | ||
return hashlib.md5(tmp).hexdigest() | ||
|
||
def _first (list): | ||
if len(list) > 0: | ||
return list[0] | ||
return '' | ||
|
||
def _big_type_get_title (big_type): | ||
_print_json(big_type) | ||
|
||
def _print_json (json_data): | ||
print _stringify_json(json_data, True) |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/python | ||
# -*- coding: UTF-8 -*- | ||
|
||
import sys | ||
import main | ||
|
||
if len(sys.argv) > 1: | ||
query = sys.argv[1] | ||
else: | ||
query = '' | ||
|
||
if query: | ||
print main.get(query) | ||
else: | ||
main.clean() |
Oops, something went wrong.