Skip to content

Dev#18

Merged
binhex merged 4 commits into
mainfrom
dev
Apr 18, 2026
Merged

Dev#18
binhex merged 4 commits into
mainfrom
dev

Conversation

@binhex
Copy link
Copy Markdown
Owner

@binhex binhex commented Apr 18, 2026

No description provided.

binhex and others added 4 commits April 18, 2026 23:37
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add a TTY-only animated braille spinner (_spinner context manager) to
cli.py that shows activity during operations that can take seconds to
minutes to complete.

Spinner is active during:
- verify_connection    -> 'Connecting to slskd...'
- scan_library         -> 'Scanning library...'
- network_search       -> 'Searching Soulseek for <query>...'
- user_browse x2       -> 'Browsing <user>...'

Modelled on the identical pattern in trimarr. No-ops silently when
stderr is not a TTY (CI, Docker, piped output).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The spinner thread writes \r-based frames to stderr while loguru's
console sink writes to stdout. On a TTY both streams share the same
terminal so log lines appeared on the same line as the spinner.

- Add module-level _terminal_lock (threading.Lock) and _spinner_active
  (threading.Event) in cli.py to coordinate terminal writes
- Spinner thread acquires _terminal_lock for each frame write and for
  the final erase; uses \r\033[K (clear-to-EOL) instead of width math
- _spinner_active is set before the thread starts and cleared only
  after thread.join(), so the race window is eliminated
- New _make_console_sink() returns a loguru sink that acquires the lock
  and erases the spinner line before printing the log message
- create_logger() gains an optional console_sink parameter so callers
  can supply the spinner-aware sink without coupling logger.py to cli.py

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@binhex binhex merged commit b39daa5 into main Apr 18, 2026
1 check passed
binhex added a commit that referenced this pull request Apr 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant