fd744a1a85a1845d3c392f15218e0838147e50dc
6 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
fd744a1a85
|
Make the YouTube account reachable, and applied without a restart
The cookie login was not missing, it was buried: Downloads tab -> Custom Options -> the "Login with Cookies" tab, where Downloads is one tab of five. The three features that depend on it -- the Feed's account mode, Search and Browse -- are other tabs, with no route to it. show_cookie_login_dialog(), which opens that dialog on the right tab, had no caller anywhere in the codebase; it does now. An account button sits in the corner of the tab bar, visible from every tab, saying whether cookies are in use and where they came from. The Feed offers the same thing next to its account mode rather than greying the option out and leaving it at that, and the disabled entry now says why it is disabled. Applying cookies used to require a restart before playback saw them: _build_ytdl_raw_options was read once, when the player widget was built. A cookiesChanged signal now reaches the account button, the Feed and the live mpv handle, and the player reloads at its current position -- ytdl_hook consults the option when it resolves a URL, so anything already playing keeps the streams it resolved with. YtdlpClient needed no change: it re-reads config per call. Two bugs in the same function: the options are joined with commas and were never escaped, so a cookie path or a proxy URL containing one silently ended the option and started a bogus one; and geo_proxy_url was honoured by the downloader but never passed to the player, so a geo-restricted video would download and then refuse to play. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
27933dd495
|
Make the player answer the keyboard and the mouse
PlayerPanel.keyPressEvent handled Space, F and Escape and was dead code: nothing in the player called setFocusPolicy, so focus went to whichever child button, slider or combo box was first in the tab order, and that child ate the keys. Fixing focus alone would not have been enough -- clicking play parks focus on the play button, which then swallows Space -- so the control bar is explicitly NoFocus and the bindings are QShortcuts with WidgetWithChildrenShortcut context on the panel. That fires whichever descendant holds focus, and does not reach the Search box or the URL field on other tabs the way an application shortcut would. mpv's own input stays disabled. With vo=libmpv there is no mpv-owned window, so its input layer receives nothing; enabling default bindings would mean hand-forwarding events through a Qt-to-mpv key-name table, handing mpv the OSD and OSC that are switched off here, and letting `q` quit the core out from under the Qt UI. One declarative action table now drives the shortcuts, the context menu and the buttons. There was no mouse handling at all. Click pauses, double-click goes fullscreen -- via a doubleClickInterval timer, so a double-click does not also pause on the way -- the wheel changes volume and Ctrl+wheel seeks, with sub-notch deltas accumulated so a trackpad is not inert. The control bar gained previous, next and mute. Mute and volume are driven by observed mpv properties rather than assumed, so the icon follows a change made by key, menu or mpv itself. Buffering was completely invisible: a stalled stream showed a frozen frame for 25 seconds before the retry with nothing on screen, so paused-for-cache now surfaces a label over the video. WatchPage owns next/previous because it owns the queue; the panel only asks. Previous restarts the current item when it is more than five seconds in, as every other player does, and pushes the interrupted item back onto the head of the queue rather than dropping it. Verified: all 38 bindings install, every action is a no-op rather than an exception with nothing loaded, focus policies are as intended, and a fullscreen round trip drives the player state correctly. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
3aca43b372
|
Give the app icons, tooltips and a finished theme
There was no icon system at all. Transport buttons called QStyle.standardIcon(SP_MediaPlay), which returns the platform theme's dark monochrome glyph -- painted onto the app's saturated red buttons at a fixed 36px with no text, that is the black square. Everything else called an icon was an emoji baked into en.json, which is tofu wherever the emoji font is missing. Qt stylesheets cannot recolour a QIcon, so the colour is an argument to the new helper; that is the whole fix. The SVGs are drawn here rather than vendored, which keeps a third-party licence out of the tree, and they live in the module rather than as asset files, which keeps them out of package-data and safe in a frozen build. Tooltips were the other half: three widgets in the entire application had one and nothing set an accessible name. Filling that in at the call sites would have meant editing well over a hundred of them, most in upstream-owned files. Instead one application-level event filter handles QEvent.Polish, which Qt sends to every widget once before it is shown -- so it also reaches dialogs built by upstream code, and survives the next merge. It maps placeholder emoji to icons, fills empty tooltips from the button text, and logs icon-only buttons that still have none so the gaps are findable. StyleSheet.MAIN styles the window, inputs, buttons and tables and nothing else, so the main tab bar, combos, sliders, lists, menus, splitters, tooltips and the horizontal scrollbar fell through to the platform style. EXTRA_QSS covers them, in a fork-owned module appended at the one application site. SmoothTabWidget names its frame "tabContent" with the comment "We draw border on content instead" -- that rule existed only inside two dialogs, and now exists for the main window too. Two corrections to rules that were already there: the pressed style changed the padding, shifting every label two pixels and clipping fixed-width icon buttons, and checkboxes were fully rounded, which reads as a radio button rather than an on/off toggle. Verified by screenshot on the real display: tab bar, buttons, combo carets and checkboxes all render as intended, and all 35 icons rasterise non-empty. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
5ae2817eea
|
Stop the player freeing a render context libmpv still uses
The segfault: Qt destroys and recreates a widget's QOpenGLContext whenever it moves to another top-level window, then calls initializeGL() again. libmpv permits one render context per handle, so the second creation failed with "There is already a mpv_render_context set" -- and the except branch assigned self._render_ctx = None, dropping the last Python reference to the first context, which libmpv was still holding a function pointer into. python-mpv's MpvRenderContext has no __del__ and free() does not unregister the callback, so the ctypes trampoline was collected while registered and the next frame notification jumped into freed memory. Two invariants fix it. initializeGL() now tears down any existing render context first, so a second call is an ordinary recreation. Teardown clears update_cb, calls free() with the GL context current, and only then drops the reference -- and it is connected to QOpenGLContext.aboutToBeDestroyed, so it runs before the GL context dies instead of never. The local reference during teardown is load-bearing: it is what keeps the trampoline alive until free() returns. Three things were destroying that context. Fullscreen reparented the panel into a new top-level window (twice per toggle) and put it back at the end of the splitter, losing the pane layout; it now fullscreens the main window and hides the chrome, reparenting nothing. The tab cross-fade and the dialog blur both grab() the widget tree, which on an OpenGL surface forces a framebuffer readback and returns black -- the fade is skipped for pages holding the video, and dialogs dim rather than blur. Verified on a real Wayland GL context: ten forced context destroy/recreate cycles re-establish the render context every time, and the full app survives tab switching, six fullscreen toggles and resizes with no render-context error and a clean exit. Before this, the same startup dumped core. Also here because they are one-line consequences of touching _create_mpv: an explicit per-platform hwdec list ending in software decoding, and the restored volume actually reaching mpv -- the slider set its value before connecting its signal, so playback always started at 100. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
a8ebe89cc1 |
Wire watch history, resume positions and persistent queue
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> |
||
|
|
f886125857 |
Add embedded mpv player (render API + QOpenGLWidget)
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> |