feat: add smart subtitle language fallback when requested locale unavailable

CHANGES
- Introduce findVTTFilesWithFallback to handle subtitle language absence
- Prefer requested language VTT, gracefully fallback to available alternatives
- Auto-detect downloaded subtitle language and proceed without interruption
- Update yt-dlp processing to use fallback-aware VTT discovery
- Document language fallback behavior and provide usage example
- Return first available VTT when no specific language requested
- Detect language-coded filenames using regex for robust matching
This commit is contained in:
Kayvan Sylvan
2025-08-08 23:39:12 -07:00
parent caca366511
commit 8414e72545
2 changed files with 71 additions and 4 deletions

View File

@@ -215,6 +215,19 @@ fabric -y "https://www.youtube.com/watch?v=VIDEO_ID" --pattern write_blog_post
- **Try without language specification** - let yt-dlp choose any available language
- **Try English instead** - `fabric -g en` (English subtitles may be less rate-limited)
### Language Fallback Behavior
When you specify a language (e.g., `-g es` for Spanish) but that language isn't available or fails to download:
1. **Automatic fallback**: Fabric automatically retries without language specification
2. **Smart file detection**: If the fallback downloads a different language (e.g., English), Fabric will automatically detect and use it
3. **No manual intervention needed**: The process is transparent to the user
```bash
# Even if Spanish isn't available, this will work with whatever language yt-dlp finds
fabric -g es -y "https://youtube.com/watch?v=VIDEO_ID" --pattern summarize
```
## Configuration
### YAML Configuration