Crates.io | radiobrowser |
lib.rs | radiobrowser |
version | 0.6.1 |
source | src |
created_at | 2022-04-21 21:11:27.024709 |
updated_at | 2023-10-20 18:52:34.586033 |
description | Client library for radiobrowser compatible servers with auto fallback to other available servers |
homepage | |
repository | https://gitlab.com/radiobrowser/radiobrowser-lib-rust |
max_upload_size | |
id | 571874 |
size | 100,850 |
Client library for radio-browser.info and other radio-browser-rust servers
It needs to have the feature "blocking" enabled. Cargo.toml entry:
radiobrowser = { version = "*", features = ["blocking"] }
use radiobrowser::blocking::RadioBrowserAPI;
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
let mut api = RadioBrowserAPI::new()?;
let servers = RadioBrowserAPI::get_default_servers()?;
println!("Servers: {:?}", servers);
let status = api.get_server_status()?;
println!("Status: {:?}", status);
let countries = api.get_countries().send()?;
println!("Countries: {:?}", countries);
let stations = api.get_stations().name("jazz").send()?;
println!("Stations: {:?}", stations);
Ok(())
}
Cargo.toml entry
radiobrowser = "*"
use radiobrowser::RadioBrowserAPI;
use radiobrowser::StationOrder;
use std::error::Error;
#[async_std::main]
async fn main() -> Result<(), Box<dyn Error>> {
let mut api = RadioBrowserAPI::new().await?;
let stations = api
.get_stations()
.name("jazz")
.reverse(true)
.order(StationOrder::Clickcount)
.send()
.await?;
println!("Stations found: {}", stations?.len());
Ok(())
}
Documentation is at https://docs.rs/radiobrowser
This project is MIT licensed.