//! 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 = 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::()) .unwrap_or_else(|| "".into()), ); } } fn normalize(s: &str) -> String { s.to_lowercase() .chars() .filter(|c| c.is_alphanumeric()) .collect() }