Files
SoulStream/crates/metadata/examples/lookup.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

34 lines
1.1 KiB
Rust

//! Live check: MusicBrainz lookup + art fetch.
//! cargo run -p metadata --example lookup -- "Nirvana" "Nevermind"
#[tokio::main]
async fn main() {
let artist = std::env::args().nth(1).unwrap_or_else(|| "Nirvana".into());
let album = std::env::args()
.nth(2)
.unwrap_or_else(|| "Nevermind".into());
let client = metadata::MetadataClient::new();
match client.lookup_album(&artist, &album).await {
Some(meta) => {
println!(
"MB: {} — {} ({:?}) mbid={:?}",
meta.artist, meta.album, meta.year, meta.release_mbid
);
match client
.fetch_art(
meta.release_mbid.as_deref(),
meta.release_group_mbid.as_deref(),
&meta.artist,
&meta.album,
)
.await
{
Some(bytes) => println!("ART: {} bytes (starts {:02x?})", bytes.len(), &bytes[..4]),
None => println!("ART: none found"),
}
}
None => println!("MB: no match"),
}
}