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.
Au lieu d'avoir un cache_registry centralisé dans pmoupnp qui créait
des dépendances circulaires, chaque crate a maintenant son propre
singleton global :
- pmoaudiocache : register_audio_cache() + get_audio_cache()
- pmocovers : register_cover_cache() + get_cover_cache()
Changes:
- Add singleton pattern to pmoaudiocache/src/lib.rs
- Add singleton pattern to pmocovers/src/lib.rs
- Add once_cell dependency to both crates
- Update pmoplaylist to use pmoaudiocache::get_audio_cache() as fallback
- Update pmoupnp/upnp_server.rs to use register_* functions
- Update pmoupnp/lib.rs to reexport only get_* (not register_*)
- Remove pmoupnp/src/cache_registry.rs (no longer needed)
pmoupnp réexporte get_audio_cache() et get_cover_cache() pour
compatibilité avec le code existant (pmosource, etc.).
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.