fix #31
This commit is contained in:
parent
96432ca023
commit
b2754e080c
@ -2,27 +2,32 @@
|
||||
import re
|
||||
from ..base import *
|
||||
|
||||
|
||||
VOICE_PATTERN = r'<a href="sound://([\w/]+\w*\.mp3)"><img src="img/spkr_%s.png"></a>'
|
||||
VOICE_PATTERN_WQ = r'<span class="%s"><a href="sound://([\w/]+\w*\.mp3)">(.*?)</span %s>'
|
||||
MAPPINGS = [
|
||||
['br', [re.compile(VOICE_PATTERN % r'r')]],
|
||||
['us', [re.compile(VOICE_PATTERN % r'b')]]
|
||||
['br', [re.compile(VOICE_PATTERN % r'r'), re.compile(VOICE_PATTERN_WQ % (r'brevoice', r'brevoice'))]],
|
||||
['us', [re.compile(VOICE_PATTERN % r'b'), re.compile(VOICE_PATTERN_WQ % (r'amevoice', r'amevoice'))]]
|
||||
]
|
||||
LANG_TO_REGEXPS = {lang: regexps for lang, regexps in MAPPINGS}
|
||||
DICT_PATH = u'' # u'E:\\BaiduYunDownload\\mdx\\L6mp3.mdx'
|
||||
|
||||
|
||||
@register([u'本地词典-LDOCE6', u'MDX-LDOCE6'])
|
||||
class Ldoce6(MdxService):
|
||||
|
||||
def __init__(self):
|
||||
from ...service import service_manager, service_pool
|
||||
dict_path = ''
|
||||
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'LDOCE6'):
|
||||
dict_path = service.dict_path
|
||||
break
|
||||
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'LDOCE6'):
|
||||
dict_path = service.dict_path
|
||||
break
|
||||
super(Ldoce6, self).__init__(dict_path)
|
||||
|
||||
@property
|
||||
|
||||
@ -4,26 +4,30 @@ from ..base import *
|
||||
|
||||
|
||||
VOICE_PATTERN = r'<a href="sound://([\w/]+\w*\.mp3)"><img src="img/spkr_%s.png"></a>'
|
||||
VOICE_PATTERN_WQ = r'<span class="%s"><a href="sound://([\w/]+\w*\.mp3)">(.*?)</span %s>'
|
||||
MAPPINGS = [
|
||||
['br', [re.compile(VOICE_PATTERN % r'r')]],
|
||||
['us', [re.compile(VOICE_PATTERN % r'b')]]
|
||||
['br', [re.compile(VOICE_PATTERN % r'r'), re.compile(VOICE_PATTERN_WQ % (r'brevoice', r'brevoice'))]],
|
||||
['us', [re.compile(VOICE_PATTERN % r'b'), re.compile(VOICE_PATTERN_WQ % (r'amevoice', r'amevoice'))]]
|
||||
]
|
||||
LANG_TO_REGEXPS = {lang: regexps for lang, regexps in MAPPINGS}
|
||||
DICT_PATH = u'' # u'E:\\BaiduYunDownload\\mdx\\L6mp3.mdx'
|
||||
|
||||
|
||||
@register([u'本地词典-LDOCE6', u'MDX-LDOCE6'])
|
||||
class Ldoce6(MdxService):
|
||||
|
||||
def __init__(self):
|
||||
from ...service import service_manager, service_pool
|
||||
dict_path = ''
|
||||
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'LDOCE6'):
|
||||
dict_path = service.dict_path
|
||||
break
|
||||
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'LDOCE6'):
|
||||
dict_path = service.dict_path
|
||||
break
|
||||
super(Ldoce6, self).__init__(dict_path)
|
||||
|
||||
@property
|
||||
|
||||
Loading…
Reference in New Issue
Block a user