mirror of
https://github.com/kennethreitz/interpretations.git
synced 2026-06-05 14:50:20 +00:00
Fix oscilloscope — overwrite in place instead of scrolling
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -291,9 +291,7 @@ def play_audio(buf, sample_rate, title="", info_lines=None, offset_sec=0.0):
|
||||
print()
|
||||
print(" [+/f] +5s [-/s] -5s [d] +30s [a] -30s [space] pause [n] next [p] prev [q] quit")
|
||||
print()
|
||||
print() # blank lines for oscilloscope + whitespace + progress
|
||||
print()
|
||||
print()
|
||||
print() # scope line + progress line
|
||||
|
||||
stream = sd.OutputStream(
|
||||
samplerate=sample_rate,
|
||||
@@ -363,8 +361,7 @@ def play_audio(buf, sample_rate, title="", info_lines=None, offset_sec=0.0):
|
||||
else:
|
||||
scope = "\033[90m" + "─" * scope_w + "\033[0m"
|
||||
|
||||
sys.stderr.write(f"\033[3A\r\n {scope}\n\n")
|
||||
sys.stderr.write(f"\r {icon} {cur_m}:{cur_s:02d} / {tot_m}:{tot_s:02d} {bar} \n")
|
||||
sys.stderr.write(f"\033[2A\r {scope} \r\n\n\r {icon} {cur_m}:{cur_s:02d} / {tot_m}:{tot_s:02d} {bar} ")
|
||||
sys.stderr.flush()
|
||||
|
||||
# Non-blocking single char read
|
||||
|
||||
Reference in New Issue
Block a user