Correction de la source radio paradise pour avoir un sous dossier par canal

This commit is contained in:
2025-10-19 18:14:28 +02:00
parent 1371f5d1d8
commit f3e6c59143
6 changed files with 748 additions and 448 deletions

View File

@@ -23,6 +23,7 @@ use pmoaudiocache::{AudioMetadata, Cache as AudioCache};
use pmocovers::Cache as CoverCache;
use std::collections::HashMap;
use std::sync::Arc;
use tokio::io::AsyncRead;
use tokio::sync::RwLock;
/// Métadonnées d'une piste en cache
@@ -216,6 +217,32 @@ impl SourceCacheManager {
Ok(pk)
}
/// Cache un flux audio via un reader asynchrone
pub async fn cache_audio_from_reader<R>(
&self,
source_uri: &str,
reader: R,
length: Option<u64>,
) -> Result<String>
where
R: AsyncRead + Send + Unpin + 'static,
{
let pk = self
.audio_cache
.add_from_reader(source_uri, reader, length, Some(&self.collection_id))
.await
.map_err(|e| MusicSourceError::CacheError(e.to_string()))?;
Ok(pk)
}
/// Attend que le fichier audio correspondant soit complètement disponible
pub async fn wait_audio_ready(&self, pk: &str) -> Result<()> {
self.audio_cache
.wait_until_finished(pk)
.await
.map_err(|e| MusicSourceError::CacheError(e.to_string()))
}
/// Mettre à jour les métadonnées d'une piste
///
/// Enregistre ou met à jour les métadonnées de cache pour une piste.