Musyx Mobile: Android TV player for Yandex Music

Kotlin, Compose for TV and Media3 port of the desktop Musyx, with
device-code sign-in, Home, My Wave, search, collection, detail pages,
Now Playing with queue and lyrics, and settings for streaming quality,
appearance, font size (small, medium, large) and language.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
yuriy.pandClaude Opus 5.5 committed 2026-10-16 22:14:54 +06:00
commit 46610d95fa
217 files changed
+26144

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
//! Read-only check of lossless streaming with the signed-in account:
//! `cargo run -p musyx --example stream_probe [query]`. Asks for FLAC, downloads
//! and decrypts it, and decodes the start to show the format.
use std::io::Cursor;
use std::time::Instant;
use rodio::Source;
use ym_api::auth::Credentials;
use ym_api::{SearchKind, YmClient};
#[tokio::main(flavor = "current_thread")]
async fn main() {
let raw = keyring::Entry::new("musyx", "yandex-music")
.and_then(|e| e.get_password())
.expect("sign in with Musyx first");
let credentials: Credentials = serde_json::from_str(&raw).expect("stored credentials");
let (client, account) = YmClient::connect(&credentials, ym_api::ContentLanguage::English).await.expect("connect");
println!("account: {} (plus: {})", account.login, account.has_plus);
let query = std::env::args().nth(1).unwrap_or_else(|| "земфира хочешь".into());
let found = client.search(&query, SearchKind::Tracks, 0).await.expect("search");
let track = found.tracks.first().expect("no tracks found");
println!("track: {} — {} ({})", track.artist_line(), track.title, track.id);
let started = Instant::now();
let stream = client.lossless_stream(&track.id).await.expect("stream");
println!("stream: {stream:?} label={} in {:?}", stream.label(), started.elapsed());
let started = Instant::now();
let bytes = client.fetch(&stream).await.expect("fetch");
println!("fetched {:.1} MB in {:?}, starts with {:?}", bytes.len() as f64 / 1e6, started.elapsed(), String::from_utf8_lossy(&bytes[..12]));
let decoder = rodio::Decoder::builder()
.with_data(Cursor::new(bytes.to_vec()))
.with_byte_len(bytes.len() as u64)
.with_hint(stream.container())
.with_seekable(true)
.build()
.expect("decode");
println!(
"decoded: {} Hz, {} ch, duration {:?}",
decoder.sample_rate(),
decoder.channels(),
decoder.total_duration()
);
let samples = decoder.take(48_000).filter(|s| s.abs() > 0.0).count();
println!("non-silent samples in the first 48k: {samples}");
}