Files
pmomusic/pmoupnp/src/lib.rs
Claude 123bac1fdf Add register_audio_cache/register_cover_cache functions to pmoupnp
Fix "PlaylistManager not initialized" error in play_and_cache example.
The error occurred because pmoplaylist's WriteHandle calls
pmoupnp::get_audio_cache() to validate cache pks, but the global
cache registry wasn't initialized.

Changes:
- Add register_audio_cache() and register_cover_cache() functions
- Export them from pmoupnp lib.rs
- Call them in play_and_cache example after creating caches

This mirrors how UpnpServer initializes the cache registry.
2025-11-05 19:49:59 +00:00

40 lines
799 B
Rust

mod object_set;
mod object_trait;
pub mod actions;
pub mod cache_registry;
pub mod devices;
pub mod services;
pub mod soap;
pub mod ssdp;
pub mod state_variables;
pub mod upnp_api;
pub mod upnp_server;
pub mod value_ranges;
pub mod variable_types;
use std::sync::RwLock;
use std::{collections::HashMap, sync::Arc};
pub use crate::cache_registry::{
get_audio_cache, get_cover_cache, register_audio_cache, register_cover_cache,
};
pub use crate::object_trait::*;
pub use crate::upnp_server::UpnpServerExt;
#[derive(Debug, Clone)]
pub struct UpnpObjectType {
name: String,
object_type: String,
}
#[derive(Debug)]
pub struct UpnpObjectSet<T: UpnpTypedObject> {
objects: RwLock<HashMap<String, Arc<T>>>,
}
#[derive(Debug)]
pub enum UpnpObjectSetError {
AlreadyExists(String),
}