gnosticdev commited on
Commit
9e479cb
·
verified ·
1 Parent(s): 237c3ee

Update conver.py

Browse files
Files changed (1) hide show
  1. conver.py +14 -17
conver.py CHANGED
@@ -165,20 +165,17 @@ class URLToAudioConverter:
165
  os.remove(f)
166
  return final_output, conversation_text
167
 
168
- async def raw_text_to_audio(self, text: str, voice_1: str, voice_2: str) -> Tuple[str, str]:
169
- conversation = {
170
- "conversation": [
171
- {"speaker": "Host", "text": text},
172
- {"speaker": "Co-host", "text": "(Continuación del tema)"}
173
- ]
174
- }
175
- folder_name = await self.text_to_speech(conversation, voice_1, voice_2)
176
- combined_audio = self.combine_audio_files(audio_files)
177
- music_path = "musica.mp3" # Antes: "assets/musica.mp3" (solo quité "assets/")
178
- tags_paths = ["tag.mp3", "tag2.mp3"] # Antes: "assets/tag.mp3" (solo quité "assets/")
179
- final_audio = self.add_background_music_and_tags(combined_audio, music_path, tags_paths)
180
- output_file = os.path.join(folder_name, "raw_podcast_with_music.mp3") # 👈 Se mantiene igual
181
- final_audio.export(output_file, format="mp3")
182
- for f in audio_files:
183
- os.remove(f)
184
- return text, output_file
 
165
  os.remove(f)
166
  return final_output, conversation_text
167
 
168
+ async def generate_podcast(self, conversation, voice_1, voice_2):
169
+ folder_name = await self.text_to_speech(conversation, voice_1, voice_2)
170
+ combined_audio = self.combine_audio_files(audio_files)
171
+ music_path = "musica.mp3" # Archivo en root (sin 'assets/')
172
+ tags_paths = ["tag.mp3", "tag2.mp3"] # Archivos en root
173
+ final_audio = self.add_background_music_and_tags(combined_audio, music_path, tags_paths)
174
+ output_file = os.path.join(folder_name, "raw_podcast_with_music.mp3")
175
+ final_audio.export(output_file, format="mp3")
176
+
177
+ # Limpieza de archivos temporales
178
+ for f in audio_files:
179
+ os.remove(f)
180
+
181
+ return text, output_file # Ahora el return está DENTRO de la función