Add model auto-download and English logging
This commit is contained in:
+11
-11
@@ -66,14 +66,14 @@ class AudioProcessor:
|
||||
output_path
|
||||
]
|
||||
|
||||
logger.debug("Конвертация в WAV: %s", " ".join(cmd))
|
||||
logger.debug("Converting to WAV: %s", " ".join(cmd))
|
||||
|
||||
try:
|
||||
subprocess.run(cmd, check=True, capture_output=True)
|
||||
logger.info("Файл конвертирован в WAV: %s", output_path)
|
||||
logger.info("Converted file to WAV: %s", output_path)
|
||||
return output_path
|
||||
except subprocess.CalledProcessError as e:
|
||||
logger.error("Ошибка при конвертации в WAV: %s", e.stderr.decode())
|
||||
logger.error("Failed to convert to WAV: %s", e.stderr.decode())
|
||||
raise
|
||||
|
||||
def normalize_audio(self, input_path: str) -> str:
|
||||
@@ -101,14 +101,14 @@ class AudioProcessor:
|
||||
"compand"
|
||||
] + self.compand_params.split()
|
||||
|
||||
logger.debug("Нормализация аудио: %s", " ".join(cmd))
|
||||
logger.debug("Normalizing audio: %s", " ".join(cmd))
|
||||
|
||||
try:
|
||||
subprocess.run(cmd, check=True, capture_output=True)
|
||||
logger.info("Аудио нормализовано: %s", output_path)
|
||||
logger.info("Audio normalized: %s", output_path)
|
||||
return output_path
|
||||
except subprocess.CalledProcessError as e:
|
||||
logger.error("Ошибка при нормализации аудио: %s", e.stderr.decode())
|
||||
logger.error("Failed to normalize audio: %s", e.stderr.decode())
|
||||
raise
|
||||
|
||||
def add_silence(self, input_path: str) -> str:
|
||||
@@ -135,14 +135,14 @@ class AudioProcessor:
|
||||
"pad", "2.0", "1.0" # Добавление тишины в начале и в конце (секунды)
|
||||
]
|
||||
|
||||
logger.info("Добавление тишины: %s", " ".join(cmd))
|
||||
logger.info("Adding silence padding: %s", " ".join(cmd))
|
||||
|
||||
try:
|
||||
subprocess.run(cmd, check=True, capture_output=True)
|
||||
logger.info("Тишина добавлена: %s", output_path)
|
||||
logger.info("Silence padding added: %s", output_path)
|
||||
return output_path
|
||||
except subprocess.CalledProcessError as e:
|
||||
logger.error("Ошибка при добавлении тишины: %s", e.stderr.decode())
|
||||
logger.error("Failed to add silence padding: %s", e.stderr.decode())
|
||||
raise
|
||||
|
||||
def process_audio(self, input_path: str) -> Tuple[str, list]:
|
||||
@@ -177,6 +177,6 @@ class AudioProcessor:
|
||||
return silence_path, temp_files
|
||||
|
||||
except Exception as e:
|
||||
logger.error("Ошибка при обработке аудио %s: %s", input_path, e)
|
||||
logger.error("Failed to process audio %s: %s", input_path, e)
|
||||
cleanup_temp_files(temp_files)
|
||||
raise
|
||||
raise
|
||||
|
||||
Reference in New Issue
Block a user