The internal ytsage package name is kept deliberately - renaming it
would touch every file and destroy the ability to merge upstream
YTSage changes.
- pyproject: distribution name sagetube v0.1.0, sagetube entrypoint
(ytsage alias retained), URLs point at the Gitea repo with an
Upstream link to YTSage.
- Data dirs move to SageTube/ (fresh fork, fresh state) and the config
file becomes sagetube_config.json; QApplication name and window
title read SageTube.
- About dialog credits Houmeres and links "Based on YTSage by oop7".
- App self-update check against the upstream PyPI package is disabled
by default; yt-dlp/deno/ffmpeg update flows are unaffected.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
WatchPage now records every played video in watch_history, saves the
playback position every 5 seconds and on stop/end (completed at >=95%),
and seeks back on replay when player.resume is "auto" - resume kicks in
between 30 seconds and 95% of the duration. The play queue persists
across restarts and reorders/removals write through immediately; the
main window's closeEvent flushes position and queue and releases libmpv.
PlayerPanel gains an automatic stall-retry: YouTube's CDN intermittently
serves stalled streams to non-browser clients (reproduced ~1/3 of
attempts headless with identical code), and a reload re-resolves onto a
healthy node - two retries after 25s of no playback, then a user-facing
error.
ytsage_constants now prepends the managed-binaries dir to PATH so
yt-dlp subprocesses (including mpv's ytdl_hook) can find the managed
Deno runtime - previously nothing exported APP_BIN_DIR, so the deno
integration silently never worked.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
New ytsage/utils/ytsage_library_manager.py: sagetube_library.db
(separate from the upstream download-history DB) with WAL from day one,
holding subscriptions, cached feed_items, watch_history with resume
positions, and the persisted play_queue. Watch history and queue tables
are wired up by the next commit.
FeedPage:
- Local mode: FeedRefreshWorker refreshes each subscribed channel
sequentially (feed.per_channel_items, default 15) and the grid fills
incrementally per channel; results are cached so the feed is
populated instantly on startup.
- Account mode: fetches youtube.com/feed/subscriptions with the user's
browser cookies - the real logged-in feed; the option is enabled only
while cookies are active and errors surface as a status banner.
- Sidebar lists subscriptions (double-click opens the channel in
Browse; context menu unsubscribes). Browse's Subscribe button now
toggles subscription state through the Feed page.
Verified live: subscribe -> refresh -> 15 videos cached in SQLite and
rendered as cards.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
BrowsePage accepts pasted or routed channel/playlist URLs:
- Channels get Videos / Shorts / Live sub-tabs mapped to the channel's
/videos, /shorts and /streams listings, lazily fetched 24 at a time
with -I range pagination; channel title and id resolve from a cheap
-I 1:1 metadata fetch. Subscribe emits subscribeRequested for the
Feed page to wire up.
- Playlists get a single grid with Play all (bulk-enqueues into the
Watch queue) and a Download button that deep-links the playlist into
the Downloads tab.
Workers are parented to their pages and fetch errors surface as status
text instead of crashing (verified against a channel with no videos
tab). fetch_flat_info gains an items="1:1" limiter so metadata probes
no longer enumerate whole channels.
Verified live: kurzgesagt channel (24 cards, title+id resolved) and a
17-video playlist with Play-all queueing.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The single-page downloader layout becomes the Downloads tab of a
SmoothTabWidget with Watch / Search / Feed / Browse / Downloads pages.
The init_ui edit is deliberately small (the old central widget is now
self.download_page); all new behavior lives in new modules:
- ytsage_gui_router.py: AppRouter signal hub (playVideo, queueVideo,
downloadVideo, openChannel, openPlaylist). A card's Download button
deep-links into the Downloads tab with the URL prefilled and analysis
started automatically.
- ytsage_gui_cards.py: VideoCard (thumbnail with disk cache under
APP_THUMBNAILS_DIR, title/channel/duration, Play/Queue/Download
actions, double-click to play) and VideoCardGrid (responsive grid,
Load more pagination).
- ytsage_gui_watch.py: WatchPage hosting the mpv PlayerPanel and a
drag-reorderable play queue with auto-advance on end of file.
- ytsage_gui_search.py: SearchPage running YtdlpClient.search off the
GUI thread with Load more pagination.
- Browse and Feed pages are placeholders, implemented next.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
New ytsage/gui/ytsage_gui_player.py:
- MpvRenderWidget hosts libmpv through MpvRenderContext in a
QOpenGLWidget - works on native Wayland where wid-embedding cannot -
with all mpv-thread callbacks marshalled to the GUI thread via queued
signals only.
- PlayerPanel adds transport controls: play/pause, seek slider, time
display, quality selector (caps ytdl-format height and reloads in
place), speed, volume (persisted), subtitle toggle, fullscreen
(reparent to top-level window), and Space/F/Escape keys.
- Playback resolves watch URLs through mpv's ytdl_hook pointed at the
app-managed SHA256-verified yt-dlp binary (script-opts
ytdl_hook-ytdl_path), inheriting cookies and proxy settings via
ytdl-raw-options - stream freshness, DASH muxing and nsig handling
stay in yt-dlp's hands.
New ytsage/core/ytsage_mpv.py probes libmpv availability; without it
the Watch UI shows a per-OS install hint and everything else works.
python-mpv added to dependencies (libmpv itself is a system package).
Config gains player.* and feed.* defaults.
Verified on Wayland: real YouTube video streams with position/duration
signals flowing and no thread-safety errors.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Every metadata call site previously built its own command list. The new
ytsage/core/ytsage_client.py centralizes binary resolution (managed,
verified binary only), cookie/proxy args from ConfigManager (with
session-state overrides), utf-8 output handling, process-group-safe
timeouts, and a short-TTL cache for flat/search results.
Provides fetch_video_info, fetch_flat_info, fetch_flat_entries (with
-I range pagination), search (ytsearchN:), and fetch_account_feed
(youtube.com/feed/subscriptions with cookies) plus a generic YtdlpWorker
QThread. AnalysisThread now delegates its subprocess execution to the
shared runner; its signal surface is unchanged.
Groundwork for the SageTube watch/search/browse/feed features.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- show_error_dialog() aborted when QApplication construction itself was
the failure; fall back to stderr so the real error is visible.
- Auto-update QThread cleanup dropped the last Python reference while
run() could still be unwinding ("QThread: Destroyed while thread is
still running"); defer destruction to deleteLater on finished.
- macOS ffmpeg install no longer curl|bash-es the Homebrew bootstrap
script unattended; it now asks the user to install Homebrew
themselves and fails cleanly.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Format table: a missing acodec was treated as "has audio", skipping
the +bestaudio merge and producing silent videos for extractors that
omit the field.
- Progress bar: separate video/audio stream downloads each reported
0-100%, making the bar jump backwards; per-phase scaling now maps the
two streams onto 0-50/50-100.
- Custom commands: parse with shlex (quoted arguments with spaces were
shredded by str.split), keep POSIX mode off on Windows so backslash
paths survive, hide the console window like every other call site,
close the stdout pipe, and support cancellation of a running command.
- Settings dialog: _("settings", "error_saving", ...) passed two
positional args to the i18n helper, raising TypeError inside the
except handler instead of showing the intended error dialog.
- ffmpeg on Windows: Path(os.getenv("LOCALAPPDATA")) crashed with
TypeError when the variable is unset; fall back to the standard
AppData/Local location.
- Version cache: cached path (str) was compared against a Path, so the
cache never hit and every version query spawned a subprocess.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- get_yt_dlp_path() no longer implicitly executes a bare "yt-dlp" from
PATH (on Windows that lookup includes the CWD, so a planted binary
in a writable directory could be run). A system yt-dlp is used only
behind the explicit advanced.allow_system_ytdlp config opt-in, and
then always as a which()-resolved absolute path. Analysis and
download refuse to exec the not-installed sentinel.
- Analysis subprocesses now run in their own session and the whole
process group is killed on timeout, so deno grandchildren no longer
leak; partial stderr is preserved and logged, and output decoding is
pinned to utf-8 with replacement (Windows locale codecs crashed on
non-UTF8 titles).
- Flat-playlist entries are filtered for None (private/deleted first
video no longer breaks analysis).
- update_yt_dlp() normalizes the sentinel to Path, unbreaking the pip
fallback path that crashed on str.exists().
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The yt-dlp stable/nightly channel switcher mutated QLabel/QRadioButton
state directly from a raw threading.Thread, which is undefined behavior
in Qt. The worker now only runs the subprocess and emits a signal; the
connected slot applies all widget updates on the GUI thread via Qt's
queued delivery.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Speed limit settings (value and unit) are now loaded from config on app initialization and saved to config when updated. This ensures the user's speed limit preferences persist across app restarts.
Highlight AC3/EAC3 surround-sound formats in the GUI format table and include channel/bitrate details where available. Also relax the audio-only filter so formats without filesize can still be shown.
Restore window geometry/state on startup and save them on exit. Adds YTSageApp._load_window_state() and calls it during UI init; saves Base64-encoded geometry/state via ConfigManager when closing. Adds default config keys "window_geometry" and "window_state". Includes error handling and debug logging to avoid failures if stored values are invalid.
Set the default generic_mode to True in the config manager and update GUI initialization to distinguish between a missing config and an explicit False. Replace usages of `ConfigManager.get(... ) or False` with a None check so that an explicit False value is respected. Changes made in ytsage/utils/ytsage_config_manager.py and GUI initializers in ytsage/gui/ytsage_gui_main.py and ytsage/gui/ytsage_gui_dialogs/ytsage_dialogs_settings.py.
Downloader: add detection for "Auto-generated" subtitle selection and only append --write-auto-subs when an auto-generated subtitle is explicitly chosen (prevents always enabling the flag when any subtitles are requested). GUI: update subtitle label to display the number of selected subtitles when >0, falling back to the zero-selected message otherwise. Small UX and behavior fixes in DownloadThread and AnalysisMixin.
Enhance playlist export output for Text and CSV formats. Text files now include a numeric index, a title fallback ("Video N"), and a human-readable duration ([H:MM:SS] or [MM:SS]) when available before the URL. CSV export adds a "Playlist Index" column and writes a formatted title with index and duration. Duration parsing is protected against non-integer values. M3U and JSON export behavior unchanged.
Restore cookie configuration on startup when previously active and the user opted to remember them. If config indicates a file source and the path exists, set cookie_file_path; if browser source, set browser_cookies_option. Treat missing "cookie_remember" as true by default. If the user did not opt to remember cookies, reset cookie_active to false. Added logging for restored settings and initialization state.
Introduce a "Remember Cookie Settings" QCheckBox to the cookies UI (label uses gettext key "cookies.remember_settings"). The control defaults to True when no prior setting exists and applies custom styling for the indicator and text. Its toggled signal is wired to ConfigManager.set("cookie_remember", checked) so the preference is saved immediately (avoiding dependence on an Apply button), and the value is also saved when the dialog persists other cookie settings. Uses the "cookie_remember" config key for storage.
Update AnalysisThread error handling to detect yt-dlp stderr containing "Private video" or "Sign in". For those cases, emit a localized errors.private_video message and log a specific private-video error; otherwise preserve the existing generic ytdlp_failed behavior. Playlist visibility signals and early return remain unchanged.
Replace entry.get('file_size', 0) with entry.get('file_size') or 0 in HistoryDelegate (ytsage_dialogs_history.py) to treat None as 0. This prevents TypeError when comparing None > 0 and ensures file size formatting/display only occurs for positive sizes.
Introduce a Save Playlist UI flow: import QFileDialog, group playlist action buttons into a horizontal layout, add a new "Save Playlist As" button with styling and visibility control, and connect its click to a new save_playlist_to_file method. The new method prompts for a save location and supports saving playlist_entries in TXT, M3U, CSV, or JSON formats, shows success/error message boxes, and logs exceptions. Also wire the existing playlist visibility signal to control the save button and adjust layout placement for the playlist buttons.
After populating the format table, read default_video_quality from ConfigManager and attempt to auto-select a matching video format (by resolution/height). If a matching video format is found it is checked and handle_checkbox_click is invoked to trigger selection side-effects; if not, the first (highest-quality) format is selected as a fallback. Existing visibility filtering via filter_formats is still applied afterward.
Introduce a "Default Selection Settings" group in the Download Settings dialog to let users specify a default video resolution (height) and default subtitle language(s). Adds labeled QLineEdit inputs with placeholders and explanatory help text, uses localized strings for labels, and persists values to ConfigManager under keys "default_video_quality" and "default_subtitle_language" when saving.
Load user's default_subtitle_language from ConfigManager and preselect matching manual or auto-generated subtitles on analysis load. Handles comma-separated strings, checks against available_subtitles and available_automatic_subtitles, and updates the selected subtitles list. Attempts to update the UI label and button state (with style refresh) inside a try/except to avoid errors during initialization.
Add video id to the default output filename template across the downloader and settings UI. The template was changed from "%(title)s_%(resolution)s.%(ext)s" to "%(title)s_%(resolution)s_[%(id)s].%(ext)s" in ytsage_downloader.py and ytsage_dialogs_settings.py (including placeholder and reset behavior). This helps avoid filename collisions and makes downloaded files easier to identify.
Format table: when in playlist mode and the format has a video codec, prefix the quality and (when available) resolution with "≤ " to indicate an upper-bound. Resolution is only prefixed if it's not "N/A".
Main UI: replace the old checkbox-list lookup with scanning the format_table rows to find the checked checkbox widget, pick the correct resolution column depending on playlist mode, strip any leading "≤ " and use that as the selected resolution. This fixes resolution selection for playlist entries and ensures the displayed "≤" semantics are handled when extracting values.
Previously the code assumed the height was always the second value in the "WxH" resolution string. This change splits the resolution into parts, verifies there are two components, and uses the smaller dimension (min) as the height to correctly classify vertical videos. Also avoids potential index errors when the resolution string is malformed.
Read concurrent_fragments from ConfigManager (defaulting to 1) and forward it into the DownloadThread constructor so the download fragment concurrency setting is propagated to the downloader.
Add a "Concurrent Connections" section to DownloadSettingsDialog with a QComboBox (1–20) and help text; initialize from ConfigManager("concurrent_fragments"). Introduce get_concurrent_fragments() to return the chosen value (with a safe fallback to 1) and persist the setting on dialog accept. Uses localized labels and minor styling for the help label.
Reorganize the Download Settings dialog into a SmoothTabWidget with three tabs (General, Format, File) and move existing group sections into corresponding tab layouts. Import QWidget and SmoothTabWidget, increase dialog minimum width from 450 to 550, and add stretches for better layout spacing. Overhaul the dialog stylesheet to restyle tabs, frames, group boxes, checkboxes, radio buttons, combo boxes and item views (borders, paddings, colors, radii, hover/selected states). Also style OK/Cancel buttons to match the Custom Options dialog. These changes improve the dialog's visual consistency and UX while preserving existing settings controls and behavior.
Introduce an "audio_normalization" option across the app and implement normalization for audio-only downloads. Updates include: add config default (ConfigManager), new language strings, settings UI checkbox + help text and logic to auto-enable force-audio-format when normalization is enabled, and persist the setting. Pass the setting from main app to DownloadThread, and in the downloader force re-encoding to mp3 when necessary and append --postprocessor-args ExtractAudio:-af loudnorm=... to apply EBU R128 normalization. This ensures normalization works reliably (avoids ffmpeg stream-copy errors) and keeps the behavior scoped to ExtractAudio postprocessor.
Introduce a new "check_app_updates" configuration (default: true) to allow users to enable/disable automatic YTSage update checks. Adds a styled checkbox to the Updater tab with getter, loads the setting (defaults to enabled for older configs), and saves it from the custom options dialog. The main update check now respects this setting and will skip checking when disabled. Also include English localization entries for the new UI strings.
Introduce a "generic_mode" option to allow validating/downloading from non-YouTube sites and wire it through the UI, config, and validation logic. Key changes:
- Add generic_mode default to ConfigManager and persist setting from DownloadSettingsDialog (checkbox + help text).
- Extend validate_video_url to accept a generic_mode flag and allow any http/https URL with a domain when enabled; pass this flag from Analysis and Download flows.
- Update YTSageApp to load/save generic_mode, update URL placeholder and settings tooltip behavior, and refresh tooltip when settings change.
- Improve robustness in FormatTableMixin: handle None/incorrect types for format_note, abr, resolution, ext, and codec values to avoid type errors and ensure consistent display.
- Add localization entries for generic mode, placeholder, and related help text across multiple language files and update the in-app default localization strings.
These changes enable broader site support via yt-dlp while hardening UI format handling and keeping user settings persistent.
Update AboutDialog link markup to remove explicit font-size and font-weight styles and to unify link color. The author and repo links no longer set font-size, and the sponsor link color was changed from #ea4aaa to #c90000 (and its font-size/weight removed) for consistent appearance across links.
Add a styled '❤️ Sponsor' GitHub Sponsors link to the About dialog (ytsage_dialogs_base.py). The change creates a QLabel with an external href to the sponsor page, enables openExternalLinks, and appends it to the info layout so the About dialog displays a sponsor call-to-action.
Normalize PyPI's version string (e.g. "2026.2.21") to the zero-padded GitHub tag format (e.g. "2026.02.21") before building the update target. The code splits a three-part version and pads the month/day components with two digits so stable@<tag> matches yt-dlp GitHub tagging.
Strip the 🔄 emoji from the localized loading string to avoid rendering issues and use the cleaned text for the QLabel. Tweak the label styling by changing the color from #cccccc to #888888 and removing the italic font-style for a more consistent appearance.
Add an 'Open Logs' button to the About dialog that opens the app log folder via QDesktopServices/QUrl, ensures the log directory exists, and logs warnings/errors. Include minimal styling and a handler (open_logs_folder) that uses APP_LOG_DIR and the logger. Also update settings dialog imports to include QUrl/QDesktopServices and APP_LOG_DIR. Simplify the bug report template to instruct users to open logs from the About dialog and attach ytsage.log / ytsage_error.log.
Introduce an opt-in beta updates feature: add a styled "Receive Beta Updates" checkbox in the Updater UI with i18n strings, load/save logic in the custom options dialog, and a default config key (check_beta_updates=false).
Add _fetch_github_beta_version to the update thread to query GitHub releases (selecting the highest tag) and emit update_available for newer beta builds. When beta checking is enabled, the thread will perform the GitHub beta check and return early to avoid conflicting with the PyPI check. This enables users to opt into preview releases safely.
Stop storing result_data["all_formats"] on the mixin and instead call update_format_table(result_data["all_formats"]). Replaces the previous filter_formats() call so the format table is populated directly from the fresh analysis result, avoiding reliance on a separate self.all_formats attribute.
Bump help text font-size from 10px to 11px in DownloadSettingsDialog for improved readability. Updated style for force format, audio format, and filename format help labels in ytsage/gui/ytsage_gui_dialogs/ytsage_dialogs_settings.py.
Add a Reset button next to the filename format input so users can restore the default pattern. The filename input and reset button are grouped in a QHBoxLayout; the button is fixed width (70) and sets the field back to the default %(title)s_%(resolution)s.%(ext)s. Also add the corresponding i18n key (buttons.reset -> "Reset") to en.json.
Introduce a new filename_format setting and UI to control yt-dlp output templates. ConfigManager now includes a default filename_format (%(title)s_%(resolution)s.%(ext)s). The DownloadSettingsDialog exposes a text input and help text for the format and saves the value to ConfigManager. DownloadThread now accepts a filename_format argument and uses it when building output templates for single videos and playlists. YTSageApp reads the config and passes the filename format into the download thread. Added corresponding English language strings.
Emit progress updates during URL analysis and simulate gradual progress for long-running yt-dlp operations. Added QTimer import and a progress_update Signal on AnalysisThread, with emits at multiple analysis milestones (e.g. 15, 30, 60, 70, 85, 90, 92, 95, 100). In AnalysisMixin introduced _analysis_timer and _fake_progress, connected thread progress to _handle_analysis_progress, and implemented a _update_fake_progress timer that slowly advances the progress bar between real updates. Timers are stopped on real progress, completion or error and the UI progress is reset appropriately to improve UX during long extraction steps.
Introduce check_ytdlp_deno_integration() in ytsage_yt_dlp.py to detect Deno integration by running `yt-dlp --verbose` and scanning debug output for JS runtimes containing "deno" (with timeout and logging/fallback).
Add SystemInfoThread (QThread) in ytsage_dialogs_base.py to collect yt-dlp, ffmpeg and deno presence, versions, paths, cache timestamps and integration status in the background, emitting the gathered info via info_ready. AboutDialog now starts the thread in update_system_info() and populates the UI asynchronously via _populate_system_info(), showing a small "+ yt-dlp" integration indicator next to the Deno status when detected. Refactors usage of version/cache lookups to use the thread-provided info dictionary.
Add streaming progress support to Deno upgrades and hook it into the GUI. upgrade_deno() now accepts an optional progress_callback and uses subprocess.Popen to read stdout line-by-line (line-buffered, utf-8, errors replaced), collecting output and invoking the callback as lines arrive. Added DenoUpdateThread (QThread) with finished/progress/error signals and replaced the previous background thread usage in the updater UI with this QThread. GUI slots strip ANSI escapes, truncate long messages, and update status text; buttons are re-enabled on finish/error. Improved logging and error handling for upgrade failures.
Introduce SmoothTabWidget and a FadingStackedWidget to provide cross-fade transitions between tabs. Added ytsage/gui/ytsage_smooth_tab_widget.py which implements a QTabBar + FadingStackedWidget (default 300ms fade) and overlay-based fade logic. Updated ytsage/gui/ytsage_gui_dialogs/ytsage_dialogs_custom.py to use SmoothTabWidget instead of QTabWidget and adjusted the stylesheet selector to target the new content frame (#tabContent) so existing styles continue to apply.
Add a safe blurred-overlay flow for modal dialogs by implementing run_dialog_with_blur and _apply_blur_to_pixmap on YTSageApp. The new flow captures a window screenshot, generates a blurred/dimmed pixmap via a QGraphicsScene + QGraphicsBlurEffect, shows it in an overlay QLabel with a fade-in, runs the dialog, and then removes the overlay.
Replace many direct dialog.exec() calls with run_dialog_with_blur(...) across the main GUI (download settings, about, history, playlist selection, custom options, cookie login, ffmpeg check, time range, setup success dialogs, etc.). Also add imports required for pixmap/graphics handling.
Make animate_widget_fade_in usage safer by checking for the method before calling it and falling back to setVisible(True) for format table and thumbnails to avoid QPainter/graphics-effect conflicts. Small comment/cleanup in fade-in/out methods.
Update ytsage/gui/ytsage_stylesheet.py to add explicit padding for various QPushButton:pressed rules (and QPushButton:checked:pressed) across multiple style blocks. These changes unify the visual spacing and touch feedback when buttons are pressed, ensuring consistent pressed-state layout and appearance.