Spaces:
Sleeping
Sleeping
Update utils/audio/audio_ingest.py
Browse files- utils/audio/audio_ingest.py +1 -14
utils/audio/audio_ingest.py
CHANGED
|
@@ -28,22 +28,9 @@ def _resolve_youtube_audio_url(url: str) -> str:
|
|
| 28 |
print(f"[FFmpeg Audio] yt-dlp resolve failed: {e}")
|
| 29 |
return url
|
| 30 |
|
| 31 |
-
def _resolve_audio_path(url: str) -> str:
|
| 32 |
-
# Kalau input /demo/... (dari frontend)
|
| 33 |
-
if url.startswith("/demo/"):
|
| 34 |
-
local_path = os.path.join("/app", url.lstrip("/"))
|
| 35 |
-
if os.path.exists(local_path):
|
| 36 |
-
print(f"[AudioIngest] Resolved static file {url} -> {local_path}")
|
| 37 |
-
return local_path
|
| 38 |
-
else:
|
| 39 |
-
print(f"[AudioIngest] File not found: {local_path}")
|
| 40 |
-
return url
|
| 41 |
-
return url
|
| 42 |
-
|
| 43 |
def record_audio_ffmpeg(src_url: str, duration: int = 60, sample_rate: int = 22050, seek_seconds: int = 0) -> Optional[bytes]:
|
| 44 |
src = _resolve_youtube_audio_url(src_url)
|
| 45 |
-
|
| 46 |
-
|
| 47 |
# --- This block is to make sure different kind of audio type can be extracted correctly ---
|
| 48 |
cmd = ["ffmpeg", "-hide_banner", "-loglevel", "error"]
|
| 49 |
|
|
|
|
| 28 |
print(f"[FFmpeg Audio] yt-dlp resolve failed: {e}")
|
| 29 |
return url
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
def record_audio_ffmpeg(src_url: str, duration: int = 60, sample_rate: int = 22050, seek_seconds: int = 0) -> Optional[bytes]:
|
| 32 |
src = _resolve_youtube_audio_url(src_url)
|
| 33 |
+
|
|
|
|
| 34 |
# --- This block is to make sure different kind of audio type can be extracted correctly ---
|
| 35 |
cmd = ["ffmpeg", "-hide_banner", "-loglevel", "error"]
|
| 36 |
|