๐ฌ Phase 2 Demo
1๏ธโฃ State: idle โ No Active Batch
Minimal footprint when no batch is running. Collapsed summary of last completed batch.
All videos downloaded
2๏ธโฃ State: collecting โ Preparing Batch
Blue info bar. Short-lived (~1-2s) while querying for downloadable videos.
3๏ธโฃ State: downloading โ Batch In Progress
Primary state. Emerald green with progress bar, per-item status, and Pause button.
Progress bar color: Green when all succeed. Amber when any item fails (shown above).
Pause Confirmation (during downloading)
2 downloads in progress will complete, remaining 3 will wait.
4๏ธโฃ State: cooldown โ Inter-Batch Cooldown
Amber section with countdown timer in MM:SS monospace format.
5๏ธโฃ State: paused โ Operator Paused
Yellow section with Resume button. One-click resume (no confirmation).
6๏ธโฃ State: circuit_broken โ Circuit Breaker Tripped
Red alert. No action button โ reset lives in the Circuit Breaker section above.
๐จ UI Feature Details
Progress Bar Behavior
Formula: Math.round((completed + failed) / total * 100)
Per-Item Status Icons
Batch Completion Reasons
| Reason | Display | Meaning |
|---|---|---|
| all_completed | "All videos downloaded" | Every video finished |
| circuit_breaker | "Stopped: circuit breaker tripped" | Cookie errors triggered CB |
| operator_paused | "Stopped: paused by operator" | Manual pause |
| no_more_videos | "No more eligible videos" | Queue empty |
Adaptive Polling Intervals
| State | Interval | Rationale |
|---|---|---|
| idle | 30s | Low urgency |
| collecting | 2s | Fast-changing |
| downloading | 2s | Active progress |
| cooldown | 5s | Timer accuracy |
| paused | 15s | Waiting for operator |
| circuit_broken | 15s | Waiting for reset |
Page Layout Position
๐ค Operator User Guide
Starting a Batch
Batches start automatically when auto-sync finds new videos and auto_download_enabled is true.
Auto-sync runs every sync_interval_minutes (default 10)
Batch manager collects up to youtube_max_parallel_downloads (default 9) videos
Downloads begin โ batch section shows progress
Cooldown after completion โ waits batch_cooldown_minutes (default 5)
Pausing Downloads
Click Pause or call POST /api/youtube/batch/pause
Confirm during active downloads (inline popup shows impact)
In-flight complete โ remaining videos wait
Section turns yellow with Resume button
Resuming Downloads
Click Resume (one-click, no confirmation) or POST /api/youtube/batch/resume
New batch starts immediately if ready videos exist
Handling Circuit Breaker Trips
Batch section turns red โ "Batch stopped โ circuit breaker open"
Refresh cookies โ export from browser, copy youtube_cookies.txt
Reset circuit breaker via button or POST /api/youtube/downloads/circuit-reset
Batch auto-resumes when circuit closes
Changing Cooldown Duration
Takes effect immediately. No restart needed.
๐ API Reference
| Method | Endpoint | Auth | Phase | Purpose |
|---|---|---|---|---|
| GET | /api/youtube/downloads/circuit-status | User | P1 | Circuit breaker state |
| POST | /api/youtube/downloads/circuit-reset | Operator | P1 | Manual circuit reset |
| GET | /api/youtube/feed?status=skipped | User | P1 | List skipped videos |
| POST | /api/youtube/feed/:videoId/retry | User | P1 | Retry single video |
| POST | /api/youtube/feed/bulk-retry | User | P1 | Retry all failed |
| GET | /api/youtube/queue | User | P0 | Active download queue |
| GET | /api/youtube/batch/status | User | P2 | Current batch progress |
| POST | /api/youtube/batch/pause | Operator | P2 | Pause batch processing |
| POST | /api/youtube/batch/resume | Operator | P2 | Resume batch processing |