Simplification de la gestion des channels.

This commit is contained in:
2025-11-16 07:59:09 +01:00
parent 97a383c079
commit c81a4651d6
13 changed files with 1327 additions and 102 deletions

View File

@@ -28,6 +28,7 @@ pmoconfig = { path = "../pmoconfig", optional = true }
anyhow = { version = "1.0", optional = true }
pmoaudiocache = { path = "../pmoaudiocache", optional = true }
pmocovers = { path = "../pmocovers", optional = true }
pmoplaylist = { path = "../pmoplaylist", optional = true }
tokio-util = { version = "0.7", features = ["io"], optional = true }
[features]
@@ -44,6 +45,7 @@ paradise = [
"dep:anyhow",
"dep:pmoaudiocache",
"dep:pmocovers",
"dep:pmoplaylist",
"dep:tokio-util"
]
# Feature pour activer l'API REST de Radio Paradise (en plus de la source UPnP)

View File

@@ -16,6 +16,7 @@ use axum::{
use pmoaudiocache::{get_audio_cache, register_audio_cache, AudioCacheExt, Cache as AudioCache};
use pmocovers::{get_cover_cache, register_cover_cache, Cache as CoverCache, CoverCacheExt};
use pmoparadise::{channels::ALL_CHANNELS, ParadiseChannelManager, ParadiseHistoryBuilder};
use pmoplaylist::register_audio_cache as register_playlist_audio_cache;
use std::sync::Arc;
use tokio_util::io::ReaderStream;
use tracing::{error, info};
@@ -81,6 +82,8 @@ impl ParadiseStreamingExt for pmoserver::Server {
let audio_cache = match get_audio_cache() {
Some(cache) => {
info!(" ✅ Using existing audio cache singleton");
// S'assurer qu'il est aussi enregistré dans le playlist manager
register_playlist_audio_cache(cache.clone());
cache
}
None => {
@@ -90,6 +93,7 @@ impl ParadiseStreamingExt for pmoserver::Server {
.await
.context("Failed to initialize audio cache")?;
register_audio_cache(cache.clone());
register_playlist_audio_cache(cache.clone());
cache
}
};