Exemplo n.º 1
0
def get_pronus(txtMsg):
	userid = txtMsg.source	
	content = txtMsg.content
	r = phonetic.get_pronunciations_result(content)
	if r:
		if cache_user_msg(userid,content):
			return r.pretty() + u"\n--回复#获得语音--"
		else:
			return r.pretty()
	else:
		return u"暂无解析1"
Exemplo n.º 2
0
def get_pronus(txtMsg):
    userid = txtMsg.source
    content = txtMsg.content
    r = phonetic.get_pronunciations_result(content)
    if r:
        if cache_user_msg(userid, content):
            return r.pretty() + u"\n--回复#获得语音--"
        else:
            return r.pretty()
    else:
        return u"暂无解析1"
Exemplo n.º 3
0
def get_last_msg_audio(userid):
	key = userid + "_last_content"
	content = redis_client.get(key)
	if content:
		if chn.search(content): #单个汉字
			r = phonetic.get_pronunciations_result(content)
			prons = []
			for p in r.plist:
				prons.append(p.pronunciation)
			url = audio_fetcher.get_pronounces_audio_url(prons)
			return [content, ",".join(prons), url]
		elif content.startswith("@"):
			content= content[1:]
			result = get_cache_notations(userid) 
			return get_music_msg(result)
		else:
			result = get_cache_translation(content) 
			return get_music_msg(result)
	else:
		return u"抱歉,找不到上一条消息"
Exemplo n.º 4
0
def get_last_msg_audio(userid):
    key = userid + "_last_content"
    content = redis_client.get(key)
    if content:
        if chn.search(content):  #单个汉字
            r = phonetic.get_pronunciations_result(content)
            prons = []
            for p in r.plist:
                prons.append(p.pronunciation)
            url = audio_fetcher.get_pronounces_audio_url(prons)
            return [content, ",".join(prons), url]
        elif content.startswith("@"):
            content = content[1:]
            result = get_cache_notations(userid)
            return get_music_msg(result)
        else:
            result = get_cache_translation(content)
            return get_music_msg(result)
    else:
        return u"抱歉,找不到上一条消息"