Add register_audio_cache to pmoplaylist (fix circular dependency)

Fix "PlaylistManager not initialized" error without creating circular
dependency between pmoparadise and pmoupnp.

Changes:
- Add AUDIO_CACHE static to pmoplaylist/manager.rs
- Add register_audio_cache() function to register cache
- Export register_audio_cache from pmoplaylist lib.rs
- Update audio_cache() to check local registry first, then pmoupnp
- Update play_and_cache example to use pmoplaylist::register_audio_cache
- Remove pmoupnp::register_*_cache functions (not needed)

The example now calls pmoplaylist::register_audio_cache() to make
the cache available for pk validation in WriteHandle::push().
This commit is contained in:
Claude
2025-11-05 20:02:01 +00:00
parent 123bac1fdf
commit a6cb7ac5e1
3 changed files with 34 additions and 6 deletions

View File

@@ -100,11 +100,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
)?);
tracing::debug!("Cover cache initialized at: {}", cover_cache_dir);
// Enregistrer les caches dans le registre global pmoupnp
// Enregistrer le cache audio dans pmoplaylist
// (requis par pmoplaylist pour valider les pks)
pmoupnp::register_audio_cache(audio_cache.clone());
pmoupnp::register_cover_cache(cover_cache.clone());
tracing::debug!("Caches registered in pmoupnp global registry");
pmoplaylist::register_audio_cache(audio_cache.clone());
tracing::debug!("Audio cache registered in pmoplaylist");
// Utiliser le gestionnaire de playlist singleton
tracing::info!("Getting playlist manager...");