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>
This commit is contained in:
@@ -1250,6 +1250,13 @@ class YTSageApp(QMainWindow, FormatTableMixin, VideoInfoMixin, AnalysisMixin):
|
||||
def closeEvent(self, event) -> None:
|
||||
"""Handle application close event to ensure proper cleanup of background threads."""
|
||||
try:
|
||||
# Persist watch position/queue and release libmpv
|
||||
if hasattr(self, "watch_page"):
|
||||
try:
|
||||
self.watch_page.shutdown()
|
||||
except Exception as e:
|
||||
logger.debug(f"Watch page shutdown error: {e}")
|
||||
|
||||
# Stop the analysis thread if it's running
|
||||
if hasattr(self, "_analysis_thread") and self._analysis_thread is not None and self._analysis_thread.isRunning():
|
||||
logger.info("Stopping analysis thread...")
|
||||
|
||||
Reference in New Issue
Block a user