$ show Losses/rune
Rune is a cross-platform music player and library manager built with a Rust backend and Flutter frontend. It provides local audio playback, metadata extraction, audio analysis (FFT, spectral features, MFCC, chroma), acoustic fingerprinting (MusicBrainz/Shazam-style), and a recommendation engine based on feature vectors. The system supports multi-device synchronization using Hybrid Logical Clocks (HLC) and chunked data transfer, LAN device discovery with TLS certificate pinning, and scrobbling to Last.fm, Libre.fm, and ListenBrainz. It includes a CLI tool, a Svelte-based authorization panel for remote server management, and a full GUI with cover art wall, lyrics display, dynamic mixes, and extensive theming. Architecturally, the project is a monorepo with 11 Rust crates and a Flutter app. The Rust backend (native/hub) handles database operations (SeaORM/SQLite), audio analysis, playback (rodio), networking (WebSocket/HTTP server), and sync. The Flutter frontend communicates via rinf (Rust-FFI message passing). The codebase demonstrates strong engineering practices: trait-based abstractions (FsIo, PlaybackStrategy, HLCRecord), macro-driven boilerplate reduction (collection_query!, parallel_media_files_processing!), and a clean separation of concerns between UI, business logic, and data layers. While primarily an application, it incorporates significant data engineering patterns in its sync and analysis subsystems, making it a hybrid project with reusable data infrastructure.
The LLM identified 6 files worth highlighting for reuse:
Defines the `FsIo` trait for abstract file I/O operations (read, write, list, metadata). Provides three implementations: `StdFsIo` (standard filesystem), `AndroidFsIo` (Android Storage Access Framework via SAF), and `NoOpFsIo` (for testing). This pattern allows the rest of the codebase to operate on files without platform-specific coupling, and can be extracted for any project needing portable file access.
A lightweight multi-producer, multi-consumer channel implementation optimized for streaming real-time audio analysis data. Unlike standard Rust channels, it supports multiple consumers and non-blocking reads. Used to pipe FFT results from analysis to visualization. Could be reused in any streaming or event-driven Rust application.
Implements Hybrid Logical Clocks (HLC) for causally ordering events across devices. Provides traits `HLCRecord` and `HLCModel` for database entities, along with query helpers (gt, lt, between) for SeaORM. Includes monotonicity enforcement, clock skew detection, and RFC3339 conversion. This is a production-grade distributed clock implementation that can be reused in any multi-device sync system.
Contains a precomputed 4096-point Hanning window as a static array of f64 coefficients. Used in FFT analysis to reduce spectral leakage. The coefficients are generated offline and embedded, avoiding runtime computation. This is a common DSP pattern that can be reused in any audio or signal processing project requiring windowing.
Defines the `parallel_media_files_processing!` macro that abstracts batch database querying with parallel processing. It paginates through media files, spawns worker tasks, and supports cancellation via `CancellationToken`. Used for cover art scanning, fingerprinting, and analysis. This macro encapsulates a reusable producer-consumer pattern for any batch data processing pipeline.
A Flutter widget that creates a reveal/highlight effect on hover or press, using a custom `RevealEffectPainter` with ticker-driven animations. Supports configurable radius, opacity, and animation curves. This is a non-trivial custom painting widget that can be extracted and reused in any Flutter project needing polished interactive effects.