-
Notifications
You must be signed in to change notification settings - Fork 0
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
Larify
committed
May 14, 2021
1 parent
e62982d
commit 511de9f
Showing
16 changed files
with
6,399 additions
and
1 deletion.
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 |
---|---|---|
@@ -1 +1,4 @@ | ||
# iciba-workflow | ||
# iciba-workflow | ||
|
||
Alfred版本的爱词霸的Workflow | ||
|
Binary file not shown.
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,37 @@ | ||
#!/usr/bin/python | ||
#_*_ coding:UTF-8 _*_ | ||
# | ||
# Copyright by Larify. All Rights Reserved. | ||
|
||
import urllib | ||
import hashlib | ||
import sys | ||
import time | ||
|
||
from workflow import Workflow3, web | ||
|
||
reload(sys) | ||
sys.setdefaultencoding('utf-8') | ||
|
||
def iciba_search(word): | ||
now = int(round(time.time() * 1000)) | ||
hash_key = '7ece94d9f9c202b0d2ec557dg4r9bc' | ||
hash_body = "61000006%s%s" % (now, word) | ||
hash_message = "/dictionary/word/query/web%s%s" % (hash_body, hash_key) | ||
signature = hashlib.md5(hash_message.encode()).hexdigest() | ||
query ={'client': '6', 'key': '1000006', 'timestamp': now, 'word': word, 'signature': signature} | ||
url = "https://dict.iciba.com/dictionary/word/query/web?%s" % urllib.urlencode(query) | ||
r = web.get(url).json() | ||
for dic in r["message"]["baesInfo"]["symbols"][0]["parts"]: | ||
wf.add_item("; ".join(dic["means"]), dic["part"], icon="iciba.png", valid=True, arg=word) | ||
wf.send_feedback() | ||
|
||
|
||
def main(wf): | ||
if len(wf.args) == 1: | ||
word = wf.args[0] | ||
iciba_search(word) | ||
|
||
if __name__ == '__main__': | ||
wf = Workflow3() | ||
sys.exit(wf.run(main)) |
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,128 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>bundleid</key> | ||
<string>iciba</string> | ||
<key>category</key> | ||
<string>Productivity</string> | ||
<key>connections</key> | ||
<dict> | ||
<key>8EFBAF88-2921-4611-865D-E96145651646</key> | ||
<array> | ||
<dict> | ||
<key>destinationuid</key> | ||
<string>CA1D0478-57C1-4409-9790-40021449274D</string> | ||
<key>modifiers</key> | ||
<integer>0</integer> | ||
<key>modifiersubtext</key> | ||
<string></string> | ||
<key>vitoclose</key> | ||
<false/> | ||
</dict> | ||
</array> | ||
</dict> | ||
<key>createdby</key> | ||
<string>Larify</string> | ||
<key>description</key> | ||
<string>爱词霸查词</string> | ||
<key>disabled</key> | ||
<false/> | ||
<key>name</key> | ||
<string>iciba</string> | ||
<key>objects</key> | ||
<array> | ||
<dict> | ||
<key>config</key> | ||
<dict> | ||
<key>alfredfiltersresults</key> | ||
<false/> | ||
<key>alfredfiltersresultsmatchmode</key> | ||
<integer>0</integer> | ||
<key>argumenttreatemptyqueryasnil</key> | ||
<false/> | ||
<key>argumenttrimmode</key> | ||
<integer>0</integer> | ||
<key>argumenttype</key> | ||
<integer>1</integer> | ||
<key>escaping</key> | ||
<integer>102</integer> | ||
<key>keyword</key> | ||
<string>iciba</string> | ||
<key>queuedelaycustom</key> | ||
<integer>3</integer> | ||
<key>queuedelayimmediatelyinitially</key> | ||
<true/> | ||
<key>queuedelaymode</key> | ||
<integer>2</integer> | ||
<key>queuemode</key> | ||
<integer>2</integer> | ||
<key>runningsubtext</key> | ||
<string>正在查询 {query} 中...</string> | ||
<key>script</key> | ||
<string>query="{query}" | ||
python iciba.py $query</string> | ||
<key>scriptargtype</key> | ||
<integer>0</integer> | ||
<key>scriptfile</key> | ||
<string></string> | ||
<key>subtext</key> | ||
<string></string> | ||
<key>title</key> | ||
<string>爱词霸查词</string> | ||
<key>type</key> | ||
<integer>0</integer> | ||
<key>withspace</key> | ||
<false/> | ||
</dict> | ||
<key>type</key> | ||
<string>alfred.workflow.input.scriptfilter</string> | ||
<key>uid</key> | ||
<string>8EFBAF88-2921-4611-865D-E96145651646</string> | ||
<key>version</key> | ||
<integer>3</integer> | ||
</dict> | ||
<dict> | ||
<key>config</key> | ||
<dict> | ||
<key>browser</key> | ||
<string></string> | ||
<key>spaces</key> | ||
<string></string> | ||
<key>url</key> | ||
<string>http://www.iciba.com/word?w={query}</string> | ||
<key>utf8</key> | ||
<true/> | ||
</dict> | ||
<key>type</key> | ||
<string>alfred.workflow.action.openurl</string> | ||
<key>uid</key> | ||
<string>CA1D0478-57C1-4409-9790-40021449274D</string> | ||
<key>version</key> | ||
<integer>1</integer> | ||
</dict> | ||
</array> | ||
<key>readme</key> | ||
<string>爱词霸查词</string> | ||
<key>uidata</key> | ||
<dict> | ||
<key>8EFBAF88-2921-4611-865D-E96145651646</key> | ||
<dict> | ||
<key>xpos</key> | ||
<integer>130</integer> | ||
<key>ypos</key> | ||
<integer>195</integer> | ||
</dict> | ||
<key>CA1D0478-57C1-4409-9790-40021449274D</key> | ||
<dict> | ||
<key>xpos</key> | ||
<integer>410</integer> | ||
<key>ypos</key> | ||
<integer>195</integer> | ||
</dict> | ||
</dict> | ||
<key>webaddress</key> | ||
<string>https://github.com/luoweihua7/iciba-workflow</string> | ||
</dict> | ||
</plist> |
Binary file not shown.
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,108 @@ | ||
#!/usr/bin/env python | ||
# encoding: utf-8 | ||
# | ||
# Copyright (c) 2014 Dean Jackson <deanishe@deanishe.net> | ||
# | ||
# MIT Licence. See http://opensource.org/licenses/MIT | ||
# | ||
# Created on 2014-02-15 | ||
# | ||
|
||
"""A helper library for `Alfred <http://www.alfredapp.com/>`_ workflows.""" | ||
|
||
import os | ||
|
||
# Workflow objects | ||
from .workflow import Workflow, manager | ||
from .workflow3 import Variables, Workflow3 | ||
|
||
# Exceptions | ||
from .workflow import PasswordNotFound, KeychainError | ||
|
||
# Icons | ||
from .workflow import ( | ||
ICON_ACCOUNT, | ||
ICON_BURN, | ||
ICON_CLOCK, | ||
ICON_COLOR, | ||
ICON_COLOUR, | ||
ICON_EJECT, | ||
ICON_ERROR, | ||
ICON_FAVORITE, | ||
ICON_FAVOURITE, | ||
ICON_GROUP, | ||
ICON_HELP, | ||
ICON_HOME, | ||
ICON_INFO, | ||
ICON_NETWORK, | ||
ICON_NOTE, | ||
ICON_SETTINGS, | ||
ICON_SWIRL, | ||
ICON_SWITCH, | ||
ICON_SYNC, | ||
ICON_TRASH, | ||
ICON_USER, | ||
ICON_WARNING, | ||
ICON_WEB, | ||
) | ||
|
||
# Filter matching rules | ||
from .workflow import ( | ||
MATCH_ALL, | ||
MATCH_ALLCHARS, | ||
MATCH_ATOM, | ||
MATCH_CAPITALS, | ||
MATCH_INITIALS, | ||
MATCH_INITIALS_CONTAIN, | ||
MATCH_INITIALS_STARTSWITH, | ||
MATCH_STARTSWITH, | ||
MATCH_SUBSTRING, | ||
) | ||
|
||
|
||
__title__ = 'Alfred-Workflow' | ||
__version__ = open(os.path.join(os.path.dirname(__file__), 'version')).read() | ||
__author__ = 'Dean Jackson' | ||
__licence__ = 'MIT' | ||
__copyright__ = 'Copyright 2014-2019 Dean Jackson' | ||
|
||
__all__ = [ | ||
'Variables', | ||
'Workflow', | ||
'Workflow3', | ||
'manager', | ||
'PasswordNotFound', | ||
'KeychainError', | ||
'ICON_ACCOUNT', | ||
'ICON_BURN', | ||
'ICON_CLOCK', | ||
'ICON_COLOR', | ||
'ICON_COLOUR', | ||
'ICON_EJECT', | ||
'ICON_ERROR', | ||
'ICON_FAVORITE', | ||
'ICON_FAVOURITE', | ||
'ICON_GROUP', | ||
'ICON_HELP', | ||
'ICON_HOME', | ||
'ICON_INFO', | ||
'ICON_NETWORK', | ||
'ICON_NOTE', | ||
'ICON_SETTINGS', | ||
'ICON_SWIRL', | ||
'ICON_SWITCH', | ||
'ICON_SYNC', | ||
'ICON_TRASH', | ||
'ICON_USER', | ||
'ICON_WARNING', | ||
'ICON_WEB', | ||
'MATCH_ALL', | ||
'MATCH_ALLCHARS', | ||
'MATCH_ATOM', | ||
'MATCH_CAPITALS', | ||
'MATCH_INITIALS', | ||
'MATCH_INITIALS_CONTAIN', | ||
'MATCH_INITIALS_STARTSWITH', | ||
'MATCH_STARTSWITH', | ||
'MATCH_SUBSTRING', | ||
] |
Oops, something went wrong.