$ show jpochyla/psst
Psst is a native desktop Spotify client written in Rust, designed as a fast, lightweight alternative to the official Electron-based client. It implements the proprietary Spotify session protocol (Shannon cipher, Diffie-Hellman key exchange, Mercury messaging) to stream audio directly, bypassing the Web API for playback. The application is structured as a workspace with three crates: `psst-core` (session management, audio pipeline, caching, Last.fm scrobbling), `psst-gui` (Druid-based GUI with controllers, widgets, and Web API integration), and `psst-cli` (simple command-line player). The GUI features a full browsing experience (home, search, library, artist/album/playlist/show details, lyrics, recommendations, credits) with async data loading via a Promise pattern and remote image caching. The audio pipeline includes decryption, decoding (symphonia), resampling, normalization, and output via cpal or cubeb. Authentication uses OAuth2 with PKCE and supports user-provided Spotify Client IDs. The project is actively developed with rolling releases and cross-platform builds (Windows, macOS, Linux).
The LLM identified 5 files worth highlighting for reuse:
Implements a generic actor with bounded channels for message passing, used throughout the codebase for audio output, streaming, and session workers. It encapsulates a mailbox, a handler closure, and a shutdown mechanism, providing a reusable concurrency primitive that can be extracted for any Rust project needing lightweight actors.
Defines a `Promise<T, D, E>` enum with states `Empty`, `Deferred`, `Resolved`, and `Rejected`, used to represent the lifecycle of async data loading. Combined with the `Async` widget, it provides a declarative way to render loading spinners, error messages, or content. This pattern is reusable for any GUI or CLI application that needs to manage asynchronous data with clear state transitions.
Provides a Druid controller that maps commands to closures, enabling clean separation of UI events from business logic. It is part of a family of reusable controllers (`OnCommandAsync`, `OnDebounce`, `ExClick`, `ExScroll`) that can be composed to handle complex user interactions without cluttering widget code. These patterns are applicable to any Druid-based application.
A custom Druid widget that loads images from URLs asynchronously, with an LRU memory cache and a disk cache. It handles placeholder rendering, error states, and cache eviction. This widget is self-contained and can be reused in any Druid application that needs to display remote images with caching.
Defines the `AudioSource` trait and implementations like `StereoMappedSource` and `ResampledSource` that wrap and transform audio data. This composable design allows chaining decryption, decoding, resampling, and normalization in a modular pipeline. The trait and its implementations can be extracted for any Rust audio application needing a flexible source transformation chain.