Files
pmomusic/pmoupnp/src/lib.rs
Claude ff859372cf Fix is_valid_pk to support progressive caching properly
Changes:
1. pmocache/cache_trait.rs - Fixed is_valid_pk() logic:
   - Accept files WITH completion markers (complete downloads)
   - Accept files WITHOUT markers but recent (< 60s) (downloads in progress)
   - Reject files WITHOUT markers and old (>= 60s) (failed downloads)

   This preserves progressive caching: files are valid as soon as prebuffer
   completes, without waiting for completion marker.

2. pmoupnp/cache_registry.rs - Added compatibility layer:
   - Re-exports get_audio_cache/get_cover_cache from singletons
   - Provides build_audio_url/build_cover_url for pmosource
   - Uses PMO_SERVER_URL env var for base URL

3. pmoupnp/lib.rs - Added cache_registry module to public API

This fixes "Cache entry not found" errors while maintaining progressive
caching functionality for play_and_cache example.
2025-11-07 08:09:20 +00:00

41 lines
826 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};
// Réexports pour compatibilité (seulement get_*, pas register_*)
pub use pmoaudiocache::get_audio_cache;
pub use pmocovers::get_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),
}