diff --git a/addons21/fastwq/service/dict/TLD.py b/addons21/fastwq/service/dict/TLD.py new file mode 100644 index 0000000..2864139 --- /dev/null +++ b/addons21/fastwq/service/dict/TLD.py @@ -0,0 +1,76 @@ +#-*- coding:utf-8 -*- +import os +import re +import random +from ..base import * + +DICT_PATH = u"/Users/brian/Documents/mdx/The Little Dict/TLD.mdx" # u'E:\\BaiduYunDownload\\mdx\\L6mp3.mdx' + + +@register([u'本地词典-The Little Dict', u'The Little Dict']) +class TLD(MdxService): + + def __init__(self): + dict_path = DICT_PATH + # if DICT_PATH is a path, stop auto detect + if not dict_path: + from ...service import service_manager, service_pool + for clazz in service_manager.mdx_services: + service = service_pool.get(clazz.__unique__) + title = service.builder._title if service and service.support else u'' + service_pool.put(service) + if title.startswith(u'TLD'): + dict_path = service.dict_path + break + super(TLD, self).__init__(dict_path) + + @property + def title(self): + return getattr(self, '__register_label__', self.unique) + + + def get_html_all(self): + html = self.get_html() + if not html: + self.word = self.word.lower() + html = self.get_html() + if not html: + self.word = self.word.capitalize() + html = self.get_html() + if not html: + self.word = self.word.upper() + html = self.get_html() + return html + + + @export('iWeb_Rank') + def iweb_rank(self): + m = re.findall(r'