librespot/discovery/examples/discovery.rs
2021-12-08 20:44:48 +01:00

19 lines
506 B
Rust

use futures::StreamExt;
use librespot_discovery::DeviceType;
use sha1::{Digest, Sha1};
#[tokio::main(flavor = "current_thread")]
async fn main() {
let name = "Librespot";
let device_id = hex::encode(Sha1::digest(name.as_bytes()));
let mut server = librespot_discovery::Discovery::builder(device_id)
.name(name)
.device_type(DeviceType::Computer)
.launch()
.unwrap();
while let Some(x) = server.next().await {
println!("Received {:?}", x);
}
}