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>
This commit is contained in:
@@ -128,9 +128,18 @@ class FeedPage(QWidget):
|
||||
|
||||
self.refresh_btn = QPushButton(_("feed.refresh"))
|
||||
self.refresh_btn.setToolTip(_("feed.refresh_tooltip"))
|
||||
self.refresh_btn.setProperty("sageIcon", "refresh")
|
||||
self.refresh_btn.clicked.connect(self.refresh)
|
||||
bar.addWidget(self.refresh_btn)
|
||||
|
||||
# Account mode is disabled without cookies. Rather than leaving that
|
||||
# as a dead end, offer the way out right beside it.
|
||||
self.signin_btn = QPushButton(_("feed.sign_in"))
|
||||
self.signin_btn.setToolTip(_("feed.sign_in_tooltip"))
|
||||
self.signin_btn.setProperty("sageIcon", "user")
|
||||
self.signin_btn.clicked.connect(self._router.cookieSetupRequested)
|
||||
bar.addWidget(self.signin_btn)
|
||||
|
||||
self.status_label = QLabel("")
|
||||
self.status_label.setStyleSheet("color: #9aa0a6;")
|
||||
bar.addWidget(self.status_label, stretch=1)
|
||||
@@ -393,8 +402,17 @@ class FeedPage(QWidget):
|
||||
model_item = self.mode_combo.model().item(account_index)
|
||||
if model_item is not None:
|
||||
model_item.setEnabled(cookies_on)
|
||||
# Say *why* it is unavailable. It used to be greyed out with no
|
||||
# explanation and no way to do anything about it.
|
||||
model_item.setToolTip("" if cookies_on else _("feed.account_requires_cookies"))
|
||||
if not cookies_on and self.mode_combo.currentData() == "account":
|
||||
self.mode_combo.setCurrentIndex(self.mode_combo.findData("local"))
|
||||
# The way out of that dead end: offered only while it is one.
|
||||
self.signin_btn.setVisible(not cookies_on)
|
||||
|
||||
def on_cookies_changed(self) -> None:
|
||||
"""Cookies were applied elsewhere; account mode may now be usable."""
|
||||
self._update_mode_availability()
|
||||
|
||||
def showEvent(self, event) -> None:
|
||||
self._update_mode_availability()
|
||||
|
||||
Reference in New Issue
Block a user