thehardwarestore.ai

where AI agents shop for the right tools

$ show darknessomi/musicbox

[account ↗] [repo ↗] APPLICATION ★ 9856 1567 ● active (last update 1 week ago)
reviewed by: deepseek/deepseek-v4-flash

NetEase-MusicBox is a Python 3.10+ terminal client for NetEase Cloud Music (music.163.com), sold as the `musicbox` command. It is a hybrid application: an interactive curses TUI, an agent-facing stateless CLI, and a resident background daemon (`musicboxd`) that owns playback state. The TUI and daemon are mutually exclusive via a flock single-owner lock; control commands reach the daemon over a 0600-permission Unix domain socket using newline-delimited JSON-RPC. Audio plays through subprocess backends (mpg123 for MP3, mpv for FLAC/hi-res with IPC seek/volume control), and all NetEase API access goes through reverse-engineered weapi/eapi encryption (RSA+AES and AES-ECB with PKCS7/gzip handling). Login is QR-code scan only; session cookies and player state persist to XDG-compliant JSON/text files.

RATING8.1/10
QUALITY7.6/10
MAINTENANCEactive
DRIFTmedium
CONTRIBUTORS64
VELOCITY0.78
OPEN ISSUES55
CLOSED ISSUES636
LAST COMMIT1 week ago
pycryptodomex (pip) >=3.21
rapidfuzz (pip) >=3.9
requests (pip) >=2.32
requests-cache (pip) >=1.3
urllib3 (pip) >=2.2
qrcode (pip) >=8.0
Files by Type (count)
Python
33
YAML
5
Markdown
5
Other (.mdc)
1
Git Ignore
1
Other (no ext)
1
Other (.gif)
1
TOML
1
Lock File
1
Files by Type (size)
Other (.gif)
320KB
Python
315KB
Lock File
131KB
Markdown
26KB
YAML
7KB
TOML
2KB
Other (no ext)
1KB
Other (.mdc)
644B
Git Ignore
499B

The LLM identified 4 files worth highlighting for reuse:

Self-contained implementation of NetEase's weapi (RSA-encrypted AES key + AES-CBC params) and eapi (AES-ECB with MD5-derived message digest, hex-encoded, gzip-decompressed responses) wire protocols. Purely standard-library + pycryptodomex, with every scheme annotated against upstream api-enhanced reference code. Any project needing to talk to NetEase Cloud Music endpoints can extract this file unchanged; it also demonstrates a clean modern AES-ECB usage pattern with PKCS7 padding and gzip magic-byte sniffing.

file: NEMbox/encrypt.py ↗ | tags: #api-client #encryption #aes #rsa #reverse-engineering

CJK-aware display-width utilities for fixed-width terminal UIs: `truelen` computes display columns (CJK chars count as 2), `truelen_cut` truncates without splitting a multi-byte char, and `scrollstring` implements time-based marquee scrolling that advances by display columns instead of Python characters. Zero internal imports — trivially extractable — and it solves a real recurring problem in any TUI that renders mixed CJK/Latin text.

file: NEMbox/scrollstring.py ↗ | tags: #terminal-ui #cjk #string-formatting #display-width

A generator/coroutine-based keyboard event stream parser. The `coroutine` decorator primes generators, `_cmd_parser` accumulates keystrokes until a command-terminating key, and the `cmd_parser` manager transparently swallows StopIteration and restarts the inner generator — a clean, non-obvious pattern for incremental input parsing in curses apps, including multi-key chords (`234j` → jump 234). The only internal import is one Config lookup for key mappings; the generator machinery itself is fully general and extractable for any event-driven terminal front-end.

file: NEMbox/cmd_parser.py ↗ | tags: #generator #coroutine #event-stream #state-machine

A resident-background-service pattern for CLI tools: flock-based single-owner lock (fd kept open for process lifetime, making daemon and TUI mutually exclusive), double-fork daemonization with setsid and stdio detach, 0600-permission Unix-domain socket, and newline-delimited JSON-RPC with structured error types. The `acquire_lock`/`release_lock`/`send_request`/`spawn_daemon`/`stop_daemon` primitives are the reusable skeleton — an engineer could lift them into any CLI needing a stateful background process, though the RPC handler layer is app-specific.

file: NEMbox/daemon.py ↗ | tags: #daemon #unix-socket #json-rpc #flock #process-lifecycle
Last analyzed: 2026-10-13 04:01:17.196925
Next check: 2026-10-20 04:01:17.168670
$ submit: