mirror of
https://github.com/kennethreitz/interpretations.git
synced 2026-06-05 23:00:19 +00:00
play.py: spectrum above controls, progress below
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -288,10 +288,10 @@ def play_audio(buf, sample_rate, title="", info_lines=None, offset_sec=0.0):
|
||||
if info_lines:
|
||||
for line in info_lines:
|
||||
print(f" {line}")
|
||||
print()
|
||||
print() # scope line
|
||||
print() # blank
|
||||
print(" [+/f] +5s [-/s] -5s [d] +30s [a] -30s [space] pause [n] next [p] prev [q] quit")
|
||||
print()
|
||||
print() # scope line + progress line
|
||||
print() # progress line
|
||||
|
||||
stream = sd.OutputStream(
|
||||
samplerate=sample_rate,
|
||||
@@ -363,7 +363,8 @@ 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[2A\r {scope} \r\n\n\r {icon} {cur_m}:{cur_s:02d} / {tot_m}:{tot_s:02d} {bar} ")
|
||||
# Draw: move up 3 lines, write scope, skip controls line, write progress
|
||||
sys.stderr.write(f"\033[3A\r {scope} \r\n\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