lastest correction on webapp
This commit is contained in:
@@ -5,16 +5,39 @@
|
||||
//! - Accessing the embedded WebP image
|
||||
//! - Optionally saving it to a file
|
||||
|
||||
use pmoaudiocache::cache as audio_cache;
|
||||
use pmocovers::cache as covers_cache;
|
||||
use pmoparadise::{RadioParadiseClient, RadioParadiseSource};
|
||||
use pmosource::MusicSource;
|
||||
use std::fs;
|
||||
use std::io::Write;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Create the client and source
|
||||
let client = RadioParadiseClient::new().await?;
|
||||
let source = RadioParadiseSource::new_default(client, "http://localhost:8080");
|
||||
|
||||
// Build lightweight caches under the system temp dir for this example
|
||||
let base_dir = std::env::temp_dir().join(format!(
|
||||
"pmoparadise_show_source_image_{}",
|
||||
std::process::id()
|
||||
));
|
||||
let covers_dir = base_dir.join("covers");
|
||||
let audio_dir = base_dir.join("audio");
|
||||
std::fs::create_dir_all(&covers_dir)?;
|
||||
std::fs::create_dir_all(&audio_dir)?;
|
||||
|
||||
let cover_cache = Arc::new(covers_cache::new_cache(
|
||||
covers_dir.to_string_lossy().as_ref(),
|
||||
32,
|
||||
)?);
|
||||
let audio_cache = Arc::new(audio_cache::new_cache(
|
||||
audio_dir.to_string_lossy().as_ref(),
|
||||
32,
|
||||
)?);
|
||||
|
||||
let source = RadioParadiseSource::new_default(client, cover_cache, audio_cache);
|
||||
|
||||
// Display source information
|
||||
println!("Music Source Information");
|
||||
|
||||
Reference in New Issue
Block a user