From ea1dafa8dd510762f6e3525656daba2f490a9d90 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Fri, 3 Apr 2026 16:56:38 -0400 Subject: [PATCH] play.py: Ctrl+C/q returns to menu during play-all, auto-advance on track end Co-Authored-By: Claude Opus 4.6 (1M context) --- play.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/play.py b/play.py index faa69e1..a3520b5 100644 --- a/play.py +++ b/play.py @@ -326,6 +326,7 @@ def play_audio(buf, sample_rate, title="", info_lines=None, offset_sec=0.0): if select.select([sys.stdin], [], [], 0.15)[0]: ch = sys.stdin.read(1) if ch == "q" or ch == "\x03": # q or Ctrl+C + state["action"] = "stop" state["quit"] = True elif ch == " ": with lock: @@ -928,12 +929,14 @@ def main(): while i < len(files): print(f"\n{'═' * 40}") result_action = _play_track(files[i], args) - if result_action == "next": + if result_action == "stop": + break # q or Ctrl+C — back to menu + elif result_action == "next": i += 1 elif result_action == "prev": i = max(0, i - 1) else: - i += 1 + i += 1 # track ended naturally — auto-advance elif act == "render_all": import subprocess from concurrent.futures import ThreadPoolExecutor, as_completed