update:格式化代码

This commit is contained in:
hrz
2025-02-14 00:54:59 +08:00
parent eae590eb26
commit c5180df9ac
11 changed files with 34 additions and 34 deletions
+4 -10
View File
@@ -1,20 +1,14 @@
import asyncio
import logging
import os
import json
import uuid
import base64
# from datetime import datetime
# import edge_tts
import numpy as np
import opuslib
# import requests
# from core.utils.util import read_config, get_project_dir
from pydub import AudioSegment
from abc import ABC, abstractmethod
logger = logging.getLogger(__name__)
class TTSProviderBase(ABC):
def __init__(self, config, delete_audio_file):
self.delete_audio_file = delete_audio_file
@@ -34,8 +28,8 @@ class TTSProviderBase(ABC):
max_repeat_time = max_repeat_time - 1
logger.error(f"语音生成失败: {text}:{tmp_file},再试{max_repeat_time}")
if max_repeat_time>0:
logger.info(f"语音生成成功: {text}:{tmp_file},重试{5-max_repeat_time}")
if max_repeat_time > 0:
logger.info(f"语音生成成功: {text}:{tmp_file},重试{5 - max_repeat_time}")
return tmp_file
except Exception as e:
@@ -86,4 +80,4 @@ class TTSProviderBase(ABC):
opus_data = encoder.encode(np_frame.tobytes(), frame_size)
opus_datas.append(opus_data)
return opus_datas, duration
return opus_datas, duration