Fix: Avatar/media path resolution and voice clone dependencies

- Remove nltk dependency from step4_assets by inlining _extract_user_id
- Add graceful error handling for step4_assets in podcast-only mode
- Fix media_utils.py to use tenant-aware get_podcast_media_read_dirs()
- Resolves avatar image 404 during scene image generation
This commit is contained in:
ajaysi
2026-04-20 08:01:45 +05:30
parent bfa1b028b3
commit ba9ddbf368
3 changed files with 34 additions and 10 deletions

View File

@@ -97,13 +97,22 @@ def resolve_media_path(media_url_or_path: str) -> Optional[Path]:
# Prioritize YouTube paths
pass # Already first in list
elif "/api/podcast/" in media_url_or_path:
# Prioritize Podcast paths
search_paths = [
PODCAST_AVATARS_DIR / filename,
PODCAST_IMAGES_DIR / filename,
YOUTUBE_AVATARS_DIR / filename,
YOUTUBE_IMAGES_DIR / filename
]
# Prioritize Podcast paths: use centralized podcast media resolution
try:
# Import the centralized function that checks tenant workspace first
from api.podcast.constants import get_podcast_media_read_dirs
podcast_dirs = get_podcast_media_read_dirs("image")
search_paths = []
for pod_dir in podcast_dirs:
# Add both avatar and image subdirectories
search_paths.append(pod_dir / "avatars" / filename)
search_paths.append(pod_dir / filename)
except ImportError:
# Fallback if podcast constants not available
search_paths = [
PODCAST_AVATARS_DIR / filename,
PODCAST_IMAGES_DIR / filename,
]
# Iterate and find first existing file
for path in search_paths: