修复语音失效的问题

This commit is contained in:
shuaikangzhou 2023-12-27 21:31:57 +08:00
parent 598286bf42
commit 3974438d78
3 changed files with 3 additions and 11 deletions

View File

@ -315,12 +315,11 @@ class ChildThread(QThread):
try: try:
audio_path = media_msg_db.get_audio_path(msgSvrId, output_path=origin_docx_path + "/voice") audio_path = media_msg_db.get_audio_path(msgSvrId, output_path=origin_docx_path + "/voice")
audio_path = audio_path.replace('/', '\\') audio_path = audio_path.replace('/', '\\')
modify_audio_metadata(audio_path, displayname)
os.utime(audio_path, (timestamp, timestamp))
audio_path = audio_path.replace('\\', '/') audio_path = audio_path.replace('\\', '/')
audio_path = "./voice/" + os.path.basename(audio_path) audio_path = "./voice/" + os.path.basename(audio_path)
voice_to_text = escape_js_and_html(media_msg_db.get_audio_text(str_content)) voice_to_text = escape_js_and_html(media_msg_db.get_audio_text(str_content))
except: except:
logger.error(traceback.format_exc())
return return
doc.write( doc.write(
f'''{{ type:34, text:'{audio_path}',is_send:{is_send},avatar_path:'{avatar}',voice_to_text:'{voice_to_text}',timestamp:{timestamp},is_chatroom:{is_chatroom},displayname:'{displayname}'}},''' f'''{{ type:34, text:'{audio_path}',is_send:{is_send},avatar_path:'{avatar}',voice_to_text:'{voice_to_text}',timestamp:{timestamp},is_chatroom:{is_chatroom},displayname:'{displayname}'}},'''

View File

@ -17,7 +17,7 @@ contact: ContactPC = None
@app.route("/") @app.route("/")
def index(): def index():
# 渲染模板,并传递图表的 HTML 到模板中 # 渲染模板,并传递图表的 HTML 到模板中
return render_template("index.html") return "index.html"
@app.route("/christmas") @app.route("/christmas")
@ -87,13 +87,6 @@ def christmas():
return render_template("christmas.html", **data, **wordcloud_cloud_data, **time_data, **month_data, **calendar_data, return render_template("christmas.html", **data, **wordcloud_cloud_data, **time_data, **month_data, **calendar_data,
**emoji_data) **emoji_data)
# @app.route("/")
# def cindex():
# # 渲染模板,并传递图表的 HTML 到模板中
# return render_template("cindex.html")
@app.route('/home') @app.route('/home')
def home(): def home():
try: try:

View File

@ -158,7 +158,7 @@ python main.py
显示效果 显示效果
<img alt="聊天界面" src="doc/images/chat_.png"/> <img alt="聊天界面" src="doc/images/chat.png"/>
### 4. pc端功能展示 ### 4. pc端功能展示