radiobrowser-lib-rust/src/bin/test.rs
2022-04-21 21:18:17 +02:00

25 lines
847 B
Rust

use futures::join;
use radiobrowser_lib_rust::RadioBrowserAPI;
use radiobrowser_lib_rust::StationOrder;
use std::error::Error;
#[async_std::main]
async fn main() -> Result<(), Box<dyn Error>> {
let mut api = RadioBrowserAPI::new().await?;
let countries = api.get_countries().send();
let languages = api.get_languages().send();
let stations = api
.get_stations()
.name("jazz")
.reverse(true)
.order(StationOrder::Clickcount)
.send();
let config = api.get_server_config();
let (stations, config, countries, languages) = join!(stations, config, countries, languages);
println!("Config: {:#?}", config?);
println!("Countries found: {}", countries?.len());
println!("Languages found: {}", languages?.len());
println!("Stations found: {}", stations?.len());
Ok(())
}