Commit graph

16 commits

Author SHA1 Message Date
xpltd
6f20d29151 Log URL extraction failures to error_log for admin visibility
When a user pastes a URL and extraction fails (type=unknown), the
failure is now recorded in the error_log table with the actual yt-dlp
error message. Admins can see these in the Errors tab alongside
download failures — gives visibility into which sites/URLs users
are trying that don't work.
2026-03-21 23:39:00 -05:00
xpltd
2e87da297f Better UX for auth-required sites + playlist title fallback
- url-info returns site-specific hints for Instagram, Twitter/X, TikTok,
  Facebook when extraction fails (e.g. 'Instagram requires login. Upload
  a cookies.txt from a logged-in browser session.')
- Frontend shows the hint instead of generic 'No downloadable media found'
- Playlist entry titles fall back to URL slug (human-readable) instead of
  numeric IDs when extract_flat mode doesn't return titles
2026-03-21 23:32:56 -05:00
xpltd
cd883205c6 Enable yt-dlp remote JS challenge solver, consolidate base opts
- Add remote_components={'ejs:github'} to all yt-dlp invocations, fixing
  YouTube signature/n-parameter challenge failures that caused missing formats
- Extract _base_opts() method to consolidate quiet, no_warnings,
  remote_components, and extractor_args across all three call sites
- Removes PASSWORD_HASH from user-facing config comment
2026-03-21 22:46:21 -05:00
xpltd
f3d1f29ca1 Fix YouTube 403: cookie injection, configurable extractor_args, better errors
- Wire up get_cookie_path_for_session() in download opts — session
  cookies.txt is now passed to yt-dlp as cookiefile when present
- Add YtdlpConfig with extractor_args field, configurable via
  config.yaml or MEDIARIP__YTDLP__EXTRACTOR_ARGS env var
  (e.g. {"youtube": {"player_client": ["web_safari"]}})
- Inject extractor_args into all three yt-dlp call sites:
  _enqueue_single, _extract_info, _extract_url_info
- Enhance 403 error messages with actionable guidance directing
  users to upload cookies.txt
2026-03-21 22:13:25 -05:00
xpltd
182104e57f Persistent admin settings + new server config fields
Settings are now persisted to SQLite (config table) and survive restarts.

New admin-configurable settings (migrated from env-var-only):
- Max concurrent downloads (1-10, default 3)
- Session mode (isolated/shared/open)
- Session timeout hours (1-8760, default 72)
- Admin username
- Auto-purge enabled (bool)
- Purge max age hours (1-87600, default 168)

Existing admin settings now also persist:
- Welcome message
- Default video/audio formats
- Privacy mode + retention hours

Architecture:
- New settings service (services/settings.py) handles DB read/write
- Startup loads persisted settings and applies to AppConfig
- Admin PUT /settings validates, updates live config, and persists
- GET /admin/settings returns all configurable fields
- DownloadService.update_max_concurrent() hot-swaps the thread pool

Also:
- Fix footer GitHub URL (jlightner → xpltdco)
- Add DEPLOY-TEST-PROMPT.md for deployment testing
2026-03-19 12:11:53 -05:00
xpltd
aeb3238b84 Fix ruff lint errors: unused imports, E402 import ordering 2026-03-19 07:27:38 -05:00
xpltd
1e9014f569 Error log: failed download diagnostics for admin
Backend:
- New error_log table: url, domain, error, format_id, media_type,
  session_id, created_at
- log_download_error() called when yt-dlp throws during download
- GET /admin/errors returns recent entries (limit 200)
- DELETE /admin/errors clears all entries
- Manual purge also clears error log
- Domain extracted from URL via urlparse for grouping

Frontend:
- New 'Errors' tab in admin panel (Sessions, Storage, Errors, Settings)
- Each error entry shows: domain, timestamp, full URL, error message,
  format/media type metadata
- Red left border + error-colored message for visual scanning
- Clear Log button to wipe entries
- Empty state: 'No errors logged.'

Error entries contain enough context (full URL, error message, domain,
format, media type) to paste into an LLM for domain-specific debugging.
2026-03-19 06:34:08 -05:00
xpltd
3d778246ca Best quality format, password UX, mobile columns
Best quality format:
- Synthetic 'bestvideo+bestaudio/best' entry added at top of format
  list when the best separate video stream exceeds the best pre-muxed
  format. Shows as 'Best quality (1920x1080)' in Video+Audio group.
- YouTube typically only has 360p pre-muxed but 1080p+ as separate
  streams — users can now select full quality with auto-merge.
- Only appears when there's actually a quality advantage vs pre-muxed.

Password change UX:
- Enter key on confirm password field submits the change
- Auto-logout 1.5s after successful password change
- User sees '✓ Password changed' before being redirected home

Mobile table:
- Status column hidden on mobile (<640px) alongside Progress
- Only Name + Actions columns shown — clean two-column layout
- Removed mobile-specific status badge font tweaks (column gone)
2026-03-19 05:29:41 -05:00
xpltd
87f7996d5d Download button gating, format defaults fix, layout/UX polish
Download button:
- Disabled until URL analysis confirms downloadable content
- Shows error message for invalid URLs or pages with no media
- analyzeError state resets when URL is cleared or changed

Admin format defaults fix:
- AdminPanel now reloads configStore after saving settings
- Previously the main page kept stale config until full page refresh
- Config store import added to AdminPanel

Re-download same URL:
- Added overwrites: true to yt-dlp opts so re-downloading the
  same URL with different format options works correctly
- Previously yt-dlp would skip if intermediate file existed

UI polish:
- Clear button fixed-width (min-width: 70px) — no shift between
  'Clear' and 'Sure?' states
- Action buttons uniform sizing (inline-flex, min-width/height,
  box-sizing: border-box) — download/copy/clear all same size
- Footer no longer pushes below viewport — App.vue uses flex
  column layout, AppLayout uses flex:1 instead of min-height:100vh
- Page only scrolls when content exceeds viewport
2026-03-19 04:50:52 -05:00
xpltd
82786be485 Auto format label with extension, preferences persistence, toast, full delete
Auto format display:
- 'Auto' chip now shows detected extension: 'Auto (.webm)', 'Auto (.mp3)'
- Backend guesses extension from URL domain (youtube→webm, bandcamp→mp3,
  soundcloud→opus, etc.) and extract_info ext field for single videos

Preferences persistence:
- Media type (video/audio) and output format saved to localStorage
- Settings survive page refreshes and gear panel open/close

Toast notifications:
- Copy link shows animated toast 'Link copied to clipboard'
- Toast appears at bottom center, auto-dismisses after 2s

Full delete on cancel:
- DELETE /downloads/{id} now removes the job from DB and deletes the file
- Previously marked as 'cancelled by user' and persisted in history
- Jobs dismissed with X are completely purged from the system
2026-03-19 03:16:38 -05:00
xpltd
3931e71af5 Fix playlist support, session persistence, audio detection, progress errors
Playlist handling:
- Playlists are split into individual jobs at enqueue time
- Each entry downloads independently with its own progress tracking
- Private/unavailable playlist entries detected and reported in preview
- Individual jobs use noplaylist=True to prevent re-expansion

Session persistence:
- App.vue now calls fetchJobs() on mount to reload history from backend
- Download history survives page refresh via session cookie

Audio detection:
- Domain-based detection for known audio sources (bandcamp, soundcloud)
- Bandcamp albums now correctly trigger audio-only mode

Bug fixes:
- ProgressEvent accepts float for downloaded_bytes/total_bytes (fixes
  pydantic int_from_float validation errors from some extractors)
- SSE job_update events now include error_message for failed jobs
- Fixed test_health_queue_depth test to use direct DB insertion instead
  of POST endpoint (avoids yt-dlp side effects in test env)
2026-03-19 02:53:45 -05:00
xpltd
0d9e6b18ac M002/S04: URL preview, playlist support, admin improvements, UX polish
URL preview & playlist support:
- POST /url-info endpoint extracts metadata (title, type, entry count)
- Preview box shows playlist contents before downloading (up to 10 items)
- Auto-detect audio-only sources (SoundCloud, etc) and switch to Audio mode
- Video toggle grayed out for audio-only sources
- Enable playlist downloading (noplaylist=False)

Admin panel improvements:
- Expandable session rows show per-session job list with filename, size,
  status, timestamp, and source URL link
- GET /admin/sessions/{id}/jobs endpoint for session job details
- Logout now redirects to home page instead of staying on login form
- Logo in header is clickable → navigates to home

UX polish:
- Tooltips on output format chips (explains Auto vs specific formats)
- Format tooltips change based on video/audio mode
2026-03-19 02:32:14 -05:00
xpltd
6e27f8e424 M002/S04: output format selection, media icons, gear repositioned
- Move gear icon to left of Video/Audio toggle
- Add output format selector in options panel:
  Audio: Auto, MP3, WAV, M4A, FLAC, OPUS
  Video: Auto, MP4, WEBM
- Backend: postprocess audio to selected codec via FFmpegExtractAudio
- Backend: postprocessor_hooks capture final filename after conversion
  (fixes .webm showing when file was converted to .mp3)
- Add media type icon (video camera / music note) in download table
  next to filename, inferred from quality field and file extension
- Pass media_type and output_format through JobCreate model
2026-03-19 01:03:21 -05:00
xpltd
1da3ef37f1 M002/S04: fix filename resolution for downloads
- Use extract_info + prepare_filename to determine output filename
  before downloading (yt-dlp skips progress hooks when file exists)
- Normalize filenames to relative paths (strip output dir prefix)
- Include filename in completion SSE event so frontend displays it
- Fixes file download 404s from subdirectory source templates
2026-03-18 23:44:29 -05:00
xpltd
fd25ea7d05 M002/S04: UX review fixes — round 1
- Move Video/Audio toggle to same row as Download button
- Auto-condense toggle to icon-only below 540px
- Move gear icon to right of Download button
- Fix file download URLs: normalize filenames to relative paths in progress hook
- Display filename with visible extension (truncate middle, preserve ext)
- Remove border/box from dark mode toggle — glyph only
- Fix light/dark theme fonts: use monospace display font across all themes
2026-03-18 23:01:36 -05:00
xpltd
efc2ead796 M001: media.rip() v1.0 — complete application
Full-featured self-hosted yt-dlp web frontend:
- Python 3.12+ / FastAPI backend with async SQLite, SSE transport, session isolation
- Vue 3 / TypeScript / Pinia frontend with real-time progress, theme picker
- 3 built-in themes (cyberpunk/dark/light) + drop-in custom theme system
- Admin auth (bcrypt), purge system, cookie upload, file serving
- Docker multi-stage build, GitHub Actions CI/CD
- 179 backend tests, 29 frontend tests (208 total)

Slices: S01 (Foundation), S02 (SSE+Sessions), S03 (Frontend),
        S04 (Admin+Auth), S05 (Themes), S06 (Docker+CI)
2026-03-18 20:00:17 -05:00