Files
SoulStream/crates/metadata/examples/album_info_probe.rs
T
KeelrLeek a667b4b28e Baseline: full tree snapshot after git repository loss
The previous .git directory was found gutted (only info/ remained), so
history is unrecoverable locally. This commit restores version control
with the tree exactly as it stands: the working app, the preview-tracks
launcher on the artist hero, the scrollable-track-previews design bundle
(docs + approved mockups), and the Phase 0 validation artifacts.
2026-07-22 17:57:00 -05:00

45 lines
1.3 KiB
Rust

//! Live probe for identity-scoped release descriptions + type hints.
//!
//! Usage: cargo run -p metadata --example album_info_probe -- "Artist|Title" ...
use metadata::MetadataClient;
use std::sync::Arc;
#[tokio::main]
async fn main() {
let client = Arc::new(MetadataClient::new());
let requests: Vec<String> = std::env::args().skip(1).collect();
for request in requests {
let Some((artist, title)) = request.split_once('|') else {
eprintln!("expected Artist|Title, got {request}");
continue;
};
let search = client.catalog_search(artist).await;
let id = search
.artists
.iter()
.find(|a| normalize(&a.name) == normalize(artist))
.map(|a| a.id);
let info = client.album_info_for_artist_id(id, artist, title).await;
println!(
"{} | {} (id {:?})\n source={:?} hint={:?}\n desc={}\n",
artist,
title,
id,
info.source,
info.type_hint,
info.description
.as_deref()
.map(|d| d.chars().take(140).collect::<String>())
.unwrap_or_else(|| "<none>".into()),
);
}
}
fn normalize(s: &str) -> String {
s.to_lowercase()
.chars()
.filter(|c| c.is_alphanumeric())
.collect()
}