$ account spotiflacapp
SpotiFLAC-Mobile is a cross-platform mobile application (Android and iOS) that enables users to download and play high-fidelity music in lossless formats such as FLAC and DSD. It operates through an extension-based architecture where community-provided plugins supply download sources, metadata, lyrics, and cover art. The application integrates with streaming services like Deezer, Tidal, Qobuz, and Spotify via these extensions, handling authentication, rate limiting, and content resolution. The system is built on a multi-language stack: a core Rust backend handles audio processing, metadata tagging, library management, and network communication; a Flutter (Dart) frontend provides the user interface; and platform-specific code in Kotlin (Android) and Swift (iOS) bridges native features like file system access, USB audio output, and system audio routing. The Rust backend is exposed to mobile languages via UniFFI-generated bindings. Key data flows include: extension-based download orchestration with cancellation and progress reporting, audio file finalization (metadata embedding, ReplayGain scanning, cover art insertion), incremental library scanning with SQLite persistence, and multi-provider lyrics fetching with caching. The application also features hi-res audio authenticity verification using STFT analysis, direct USB audio output for bit-perfect playback, and a comprehensive extension management system with sandboxed JavaScript runtimes. External dependencies include FFmpeg for audio conversion, libusb for USB audio transport, and various web APIs (Deezer, MusicBrainz, LRCLib, Apple Music, etc.) for metadata and lyrics enrichment. The project demonstrates strong engineering practices with extensive unit and integration tests, a modular crate architecture, and reusable patterns for cancellation, progress tracking, and caching.
This repository contains the extension ecosystem for SpotiFLAC, a mobile application that downloads high-quality music from streaming services. The extensions are JavaScript modules that run in a sandboxed environment (vm.createContext) and implement service-specific adapters for providers like Amazon Music, Tidal, Qobuz, Deezer, Apple Music, and YouTube Music. Each extension exposes hooks such as search, download, handleUrl, and checkAvailability, and communicates with the host app via injected APIs (registerExtension, utils, session). The architecture is a set of isolated adapters with a shared pattern of quality fallback chains, retry logic with exponential backoff, metadata matching (ISRC, title, artist), and signed session authentication via a proxy API (api.zarz.moe). The primary data flow begins when a user provides a track URL or search query. The extension resolves the track metadata, checks availability (often via ISRC lookup or direct API calls), selects the highest available audio quality (e.g., Dolby Atmos, Hi-Res, Lossless), and initiates a download using signed tickets. The download process includes retry modes (poll_existing, new_ticket) and respects rate limits. The repository also includes a build script (scripts/build_packages.py) that creates reproducible .sflx archives and updates a central registry.json with SHA-256 digests for versioning and distribution. Key entry points are the source files in sources/<provider>/index.js, which contain the core business logic, and the corresponding manifest.json files that declare capabilities and permissions. The test files in tests/ demonstrate a sandbox testing pattern where host interfaces are mocked, allowing unit testing of fallback and matching logic. The repository is actively maintained with a community contribution model via pull requests, and the extension format is designed for easy addition of new streaming services.