feat: add debug mode toggle for verbose mpv logging#5
Conversation
Default playback now uses --msg-level=all=info,ipc=warn,ffmpeg=warn, which
suppresses the per-refresh IPC connect/disconnect chatter (the menu polls
mpv every 5 seconds) and per-segment HLS request lines. action_stop also
truncates the log so each new track starts fresh.
A 🐞 Debug mode toggle in the Tools submenu flips both behaviours: mpv
runs at --msg-level=all=v and the log is preserved across stop/play
cycles. Useful for diagnosing CoreAudio routing issues, 403s on YouTube
HLS segments, or yt-dlp extractor changes.
State persists in \$MENUTUBE_CONFIG_DIR/debug ("yes" | "no"). Takes effect
on the next track since --msg-level is baked in at mpv launch time.
scripts/check.sh now guards against the toggle regressing: validates that
the default render shows "Debug mode: OFF", that the dispatch persists
"yes" to the state file, and that the next render reflects the flip.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR adds a persistent debug mode toggle to the menutube plugin's Tools submenu. Debug mode increases mpv verbosity, preserves the mpv log across stop/play cycles, and stores the toggle state in a config file that applies on the next track. Default behavior uses quieter mpv logging and truncates the log on stop. ChangesDebug Mode Toggle Feature
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Summary
Adds a 🐞 Debug mode toggle in the Tools submenu and tightens default mpv logging.
Why. The mpv log was growing ~10 KB/minute even when nothing interesting was happening — most of it was IPC chatter from the menu polling mpv every 5 seconds (
Client connected/disconnectedlines at levelv) and per-segment ffmpeg HLS-request lines on live streams. Over a few days of background play the log balloons to hundreds of MB. Meanwhile, when something does go wrong (CoreAudio routing dies after Superwhisper grabs the device, YouTube returns 403 on a segment, yt-dlp extractor breaks), the useful lines are buried under that noise.Behaviour.
--msg-levelall=info,ipc=warn,ffmpeg=warnall=vState persists in
$MENUTUBE_CONFIG_DIR/debug("yes" or "no"), mirroring the existingrepeattoggle pattern. Takes effect on the next track since--msg-levelis baked in at mpv launch.Why not always-verbose
Because the typical background-music session runs for hours/days. Default-quiet keeps log files from bloating in
$TMPDIR(which on macOS survives reboots — files in/var/folders/.../T/are not wiped by default). When someone hits an actual bug, they flip the toggle, reproduce, and read a fresh focused log.Validation
./scripts/check.shnow includes a regression guard for the toggle:Debug mode: OFF<plugin> debugdispatch persistsyesto$DEBUG_FILEDebug mode: ONPlus all existing checks (xbar.var declarations, dry render, literal-tilde defense, auto-release dry-run) still pass.
coderabbit --plainlocally: No findings ✔.Files
bin/menutube.5s.shDEBUG_FILEconstant,debug_on()helper, conditional--msg-levelinaction_play, log truncate inaction_stop, newaction_debug+ dispatch case, menu toggle in Tools submenuscripts/check.shCHANGELOG.mdSummary by CodeRabbit
New Features
Tests