2021-03-12 15:39:58 +00:00
|
|
|
use futures::StreamExt;
|
2022-10-01 22:08:36 +00:00
|
|
|
use librespot_core::SessionConfig;
|
2021-03-12 15:39:58 +00:00
|
|
|
use librespot_discovery::DeviceType;
|
|
|
|
use sha1::{Digest, Sha1};
|
|
|
|
|
|
|
|
#[tokio::main(flavor = "current_thread")]
|
|
|
|
async fn main() {
|
2021-04-02 14:15:37 +00:00
|
|
|
let name = "Librespot";
|
2021-03-12 15:39:58 +00:00
|
|
|
let device_id = hex::encode(Sha1::digest(name.as_bytes()));
|
|
|
|
|
2022-10-02 00:51:55 +00:00
|
|
|
let mut server =
|
|
|
|
librespot_discovery::Discovery::builder(device_id, SessionConfig::default().client_id)
|
|
|
|
.name(name)
|
|
|
|
.device_type(DeviceType::Computer)
|
|
|
|
.launch()
|
|
|
|
.unwrap();
|
2021-03-12 15:39:58 +00:00
|
|
|
|
|
|
|
while let Some(x) = server.next().await {
|
|
|
|
println!("Received {:?}", x);
|
|
|
|
}
|
|
|
|
}
|