Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -161,7 +161,7 @@ async def download_file_from_url(url: str, retries: int = 3, delay: float = 2.0)
|
|
| 161 |
Caches successful downloads to avoid repeated requests.
|
| 162 |
"""
|
| 163 |
if url in download_cache:
|
| 164 |
-
print(f"{url} is got from cache")
|
| 165 |
return download_cache[url]
|
| 166 |
|
| 167 |
for attempt in range(1, retries + 1):
|
|
@@ -174,7 +174,7 @@ async def download_file_from_url(url: str, retries: int = 3, delay: float = 2.0)
|
|
| 174 |
temp_file.write(response.content)
|
| 175 |
temp_file.close()
|
| 176 |
|
| 177 |
-
print(f"{url} is downloaded and saved in cache")
|
| 178 |
|
| 179 |
download_cache[url] = temp_file.name
|
| 180 |
return temp_file.name
|
|
@@ -320,15 +320,15 @@ async def concat_story_audio(story: StoryCreationDTO, base_output: str, final_pa
|
|
| 320 |
scene_audio += sentence_audio
|
| 321 |
|
| 322 |
# --- Add SFX for location if available ---
|
| 323 |
-
if scene.location.path:
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
|
| 333 |
# --- Add background music if available ---
|
| 334 |
if scene.bgMusic and scene.bgMusic.musicPath:
|
|
|
|
| 161 |
Caches successful downloads to avoid repeated requests.
|
| 162 |
"""
|
| 163 |
if url in download_cache:
|
| 164 |
+
#print(f"{url} is got from cache")
|
| 165 |
return download_cache[url]
|
| 166 |
|
| 167 |
for attempt in range(1, retries + 1):
|
|
|
|
| 174 |
temp_file.write(response.content)
|
| 175 |
temp_file.close()
|
| 176 |
|
| 177 |
+
#print(f"{url} is downloaded and saved in cache")
|
| 178 |
|
| 179 |
download_cache[url] = temp_file.name
|
| 180 |
return temp_file.name
|
|
|
|
| 320 |
scene_audio += sentence_audio
|
| 321 |
|
| 322 |
# --- Add SFX for location if available ---
|
| 323 |
+
# if scene.location.path:
|
| 324 |
+
# sfx_file = await download_file_from_url(scene.location.path)
|
| 325 |
+
# if sfx_file:
|
| 326 |
+
# sfx_file_wav = ensure_wav(sfx_file)
|
| 327 |
+
# sfx_audio = AudioSegment.from_wav(sfx_file_wav)
|
| 328 |
+
# scene_audio = scene_audio.overlay(sfx_audio)
|
| 329 |
+
# # os.remove(sfx_file)
|
| 330 |
+
# else:
|
| 331 |
+
# print(f"SFX skipped for {scene.location.locationName}")
|
| 332 |
|
| 333 |
# --- Add background music if available ---
|
| 334 |
if scene.bgMusic and scene.bgMusic.musicPath:
|