diff --git a/Alfred_ywz/index3.py b/Alfred_ywz/index3.py new file mode 100644 index 0000000..58a81b6 --- /dev/null +++ b/Alfred_ywz/index3.py @@ -0,0 +1,39 @@ +#!/usr/bin/python +# encoding: utf-8 + +import sys +import json + +def read_file(json_filename): + with open(json_filename) as f: + pop_data = json.load(f) + return pop_data + +def get_json(query): + # parentPath = os.path.dirname(__file__) + filename ="./"+query+".json" + return read_file(filename) + +def switch(arg): + list = ['changyong', 'gaoxing', 'maimeng', 'zhenjing', 'shengqi', 'wunai', 'yun', 'daoqian', 'dongwu', 'haixiu', 'ku', 'memeda', 'shuila', 'zaijian', 'aojiao', 'chihuo', 'deyi', 'haipa', 'jiong', 'zan', 'nanguo', 'jian', 'qita'] + if len(arg) > 2 : + for key in list: + if key.find(arg) != -1: + return key + return + +def get_xml(query): + arg = switch(query) + if arg is None: + return + data = get_json(arg) + strs = """ + {0} + {1} + icon.png + + """ + out = [] + for key in data: + out.append(strs.format(data[key],key)) + print(''.join(out)) diff --git a/Alfred_ywz/info.plist b/Alfred_ywz/info.plist new file mode 100644 index 0000000..ec80282 --- /dev/null +++ b/Alfred_ywz/info.plist @@ -0,0 +1,135 @@ + + + + + bundleid + com.fulln.me.fmoji + connections + + 1CE015A1-B893-4DD2-A3DC-80812E535EE4 + + B54CA4B1-38F0-4CAA-9033-B03930705DF1 + + + destinationuid + 1CE015A1-B893-4DD2-A3DC-80812E535EE4 + modifiers + 0 + modifiersubtext + + vitoclose + + + + + createdby + fulln + description + 颜文字处理 + disabled + + name + ywz + objects + + + config + + autopaste + + clipboardtext + {query} + transient + + + type + alfred.workflow.output.clipboard + uid + 1CE015A1-B893-4DD2-A3DC-80812E535EE4 + version + 3 + + + config + + alfredfiltersresults + + alfredfiltersresultsmatchmode + 0 + argumenttreatemptyqueryasnil + + argumenttrimmode + 0 + argumenttype + 0 + escaping + 102 + keyword + moji + queuedelaycustom + 3 + queuedelayimmediatelyinitially + + queuedelaymode + 0 + queuemode + 1 + runningsubtext + 搜索中 + script + ITEM=`python3 -c 'import index3; index3.get_xml("{query}")'` + +cat<<EOB +<?xml version="1.0"?> +<items> +$ITEM +</items> +EOB + scriptargtype + 0 + scriptfile + + subtext + + title + Search suitable text + type + 5 + withspace + + + type + alfred.workflow.input.scriptfilter + uid + B54CA4B1-38F0-4CAA-9033-B03930705DF1 + version + 3 + + + readme + + uidata + + 1CE015A1-B893-4DD2-A3DC-80812E535EE4 + + xpos + 365 + ypos + 275 + + B54CA4B1-38F0-4CAA-9033-B03930705DF1 + + xpos + 155 + ypos + 275 + + + variablesdontexport + + version + v1.0.0 + webaddress + https://github.com/fulln/sampleScrips + +