Merge pull request #2 from coissac/claude/pmomusic-development-011CUobCDANzAoK8Vxmg85nP
Claude/pmomusic development 011 c uob cda nz ao k8 vxmg85n p
This commit is contained in:
73
Cargo.lock
generated
73
Cargo.lock
generated
@@ -441,6 +441,8 @@ dependencies = [
|
||||
"cexpr",
|
||||
"clang-sys",
|
||||
"itertools 0.13.0",
|
||||
"log",
|
||||
"prettyplease",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"regex",
|
||||
@@ -2298,17 +2300,70 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "netstat2"
|
||||
version = "0.9.1"
|
||||
name = "netlink-packet-core"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0faa3f4ad230fd2bf2a5dad71476ecbaeaed904b3c7e7e5b1f266c415c03761f"
|
||||
checksum = "72724faf704479d67b388da142b186f916188505e7e0b26719019c525882eda4"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"byteorder",
|
||||
"netlink-packet-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "netlink-packet-sock-diag"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a495cb1de50560a7cd12fdcf023db70eec00e340df81be31cedbbfd4aadd6b76"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bitflags 1.3.2",
|
||||
"byteorder",
|
||||
"libc",
|
||||
"netlink-packet-core",
|
||||
"netlink-packet-utils",
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "netlink-packet-utils"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ede8a08c71ad5a95cdd0e4e52facd37190977039a4704eb82a283f713747d34"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"byteorder",
|
||||
"paste",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "netlink-sys"
|
||||
version = "0.8.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "16c903aa70590cb93691bf97a767c8d1d6122d2cc9070433deb3bbf36ce8bd23"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"libc",
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "netstat2"
|
||||
version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "496f264d3ead4870d6b366deb9d20597592d64aac2a907f3e7d07c2325ba4663"
|
||||
dependencies = [
|
||||
"bindgen",
|
||||
"bitflags 2.10.0",
|
||||
"byteorder",
|
||||
"netlink-packet-core",
|
||||
"netlink-packet-sock-diag",
|
||||
"netlink-packet-utils",
|
||||
"netlink-sys",
|
||||
"num-derive 0.3.3",
|
||||
"num-traits",
|
||||
"thiserror 1.0.69",
|
||||
"thiserror 2.0.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3072,6 +3127,16 @@ dependencies = [
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prettyplease"
|
||||
version = "0.2.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"syn 2.0.108",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.103"
|
||||
|
||||
@@ -251,8 +251,6 @@ impl NodeLogic for FlacCacheSinkLogic {
|
||||
|
||||
pub struct FlacCacheSink {
|
||||
inner: Node<FlacCacheSinkLogic>,
|
||||
#[cfg(feature = "playlist")]
|
||||
playlist_handle_pending: Option<Arc<pmoplaylist::WriteHandle>>,
|
||||
}
|
||||
|
||||
impl FlacCacheSink {
|
||||
@@ -297,8 +295,6 @@ impl FlacCacheSink {
|
||||
let logic = FlacCacheSinkLogic::new(cache, covers, collection, encoder_options, 8);
|
||||
Self {
|
||||
inner: Node::new_with_input(logic, channel_size),
|
||||
#[cfg(feature = "playlist")]
|
||||
playlist_handle_pending: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,7 +305,7 @@ impl FlacCacheSink {
|
||||
/// * `handle` - WriteHandle de la playlist qui recevra les pk des tracks
|
||||
#[cfg(feature = "playlist")]
|
||||
pub fn register_playlist(&mut self, handle: pmoplaylist::WriteHandle) {
|
||||
self.playlist_handle_pending = Some(Arc::new(handle));
|
||||
self.inner.logic_mut().set_playlist_handle(Arc::new(handle));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -649,16 +645,7 @@ impl AudioPipelineNode for FlacCacheSink {
|
||||
panic!("FlacCacheSink is a terminal sink and cannot have children");
|
||||
}
|
||||
|
||||
async fn run(mut self: Box<Self>, stop_token: CancellationToken) -> Result<(), AudioError> {
|
||||
// Transférer le playlist_handle_pending à la logique si présent
|
||||
#[cfg(feature = "playlist")]
|
||||
if let Some(handle) = self.playlist_handle_pending.take() {
|
||||
// FIXME: Node devrait exposer une méthode logic_mut() pour permettre
|
||||
// la configuration post-construction. Pour l'instant, on ignore ce handle.
|
||||
// L'utilisateur devra configurer la playlist avant construction.
|
||||
let _ = handle;
|
||||
}
|
||||
|
||||
async fn run(self: Box<Self>, stop_token: CancellationToken) -> Result<(), AudioError> {
|
||||
Box::new(self.inner).run(stop_token).await
|
||||
}
|
||||
}
|
||||
|
||||
@@ -482,6 +482,15 @@ impl<L: NodeLogic> Node<L> {
|
||||
pub fn logic(&self) -> &L {
|
||||
&self.logic
|
||||
}
|
||||
|
||||
/// Retourne une référence mutable vers la logique métier du nœud
|
||||
///
|
||||
/// Permet de configurer la logique après construction mais avant run().
|
||||
/// Utile pour définir des options qui ne peuvent pas être connues
|
||||
/// au moment de la construction du nœud.
|
||||
pub fn logic_mut(&mut self) -> &mut L {
|
||||
&mut self.logic
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use anyhow::Result;
|
||||
use sha1::{Digest, Sha1};
|
||||
use std::{
|
||||
path::{Path, PathBuf},
|
||||
sync::Arc,
|
||||
|
||||
@@ -4,7 +4,7 @@ use crate::playlist::Playlist;
|
||||
use crate::track::PlaylistTrack;
|
||||
use crate::Result;
|
||||
use pmocache::cache_trait::FileCache;
|
||||
use pmodidl::{Container, Item, Resource};
|
||||
use pmodidl::{Container, Item};
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
//! WriteHandle : accès exclusif en écriture à une playlist
|
||||
|
||||
use crate::playlist::core::PlaylistConfig;
|
||||
use crate::playlist::record::Record;
|
||||
use crate::playlist::Playlist;
|
||||
use crate::Result;
|
||||
@@ -185,7 +184,7 @@ impl WriteHandle {
|
||||
|
||||
// Créer la nouvelle playlist persistante
|
||||
let manager = crate::manager::PlaylistManager();
|
||||
let mut new_handle = manager.create_persistent_playlist(new_id).await?;
|
||||
let new_handle = manager.create_persistent_playlist(new_id).await?;
|
||||
|
||||
// Copier le titre et la config
|
||||
new_handle.set_title(title).await?;
|
||||
|
||||
@@ -4,7 +4,6 @@ pub mod core;
|
||||
pub mod record;
|
||||
|
||||
use self::core::{PlaylistConfig, PlaylistCore};
|
||||
use self::record::Record;
|
||||
use std::sync::atomic::{AtomicU8, Ordering};
|
||||
use std::sync::{Arc, Weak};
|
||||
use std::time::SystemTime;
|
||||
|
||||
@@ -25,11 +25,10 @@ use tracing::Level;
|
||||
use tracing_subscriber::{
|
||||
Registry,
|
||||
filter::LevelFilter,
|
||||
layer::{Filter, SubscriberExt},
|
||||
layer::SubscriberExt,
|
||||
reload,
|
||||
util::SubscriberInitExt,
|
||||
};
|
||||
use utoipa::OpenApi;
|
||||
|
||||
/// Représente une entrée de log
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
@@ -440,7 +439,7 @@ fn level_to_levelfilter(level: Level) -> LevelFilter {
|
||||
|
||||
/// Crée le router pour l'API de gestion des logs
|
||||
pub fn create_logs_router(log_state: LogState) -> axum::Router {
|
||||
use axum::routing::{get, post};
|
||||
use axum::routing::get;
|
||||
axum::Router::new()
|
||||
.route("/log_setup", get(log_setup_get).post(log_setup_post))
|
||||
.with_state(log_state)
|
||||
|
||||
@@ -122,10 +122,10 @@ impl SourceCacheManager {
|
||||
let cache = self.track_cache.read().await;
|
||||
|
||||
if let Some(metadata) = cache.get(object_id) {
|
||||
if let Some(ref pk) = metadata.cached_audio_pk {
|
||||
if let Some(ref _pk) = metadata.cached_audio_pk {
|
||||
#[cfg(feature = "server")]
|
||||
{
|
||||
let url = pmoupnp::cache_registry::build_audio_url(pk, Some("stream"))
|
||||
let url = pmoupnp::cache_registry::build_audio_url(_pk, Some("stream"))
|
||||
.map_err(|e| MusicSourceError::CacheError(e.to_string()))?;
|
||||
return Ok(url);
|
||||
}
|
||||
@@ -147,7 +147,7 @@ impl SourceCacheManager {
|
||||
let cache = self.track_cache.read().await;
|
||||
|
||||
if let Some(metadata) = cache.get(object_id) {
|
||||
if let Some(ref pk) = metadata.cached_audio_pk {
|
||||
if let Some(ref _pk) = metadata.cached_audio_pk {
|
||||
// TODO: Ajouter get_info() à AudioCache
|
||||
// Pour l'instant, on retourne juste Cached sans taille
|
||||
return Ok(CacheStatus::Cached { size_bytes: 0 });
|
||||
@@ -181,10 +181,10 @@ impl SourceCacheManager {
|
||||
/// # Returns
|
||||
///
|
||||
/// L'URL complète de l'image
|
||||
pub fn cover_url(&self, pk: &str, size: Option<usize>) -> Result<String> {
|
||||
pub fn cover_url(&self, _pk: &str, _size: Option<usize>) -> Result<String> {
|
||||
#[cfg(feature = "server")]
|
||||
{
|
||||
pmoupnp::cache_registry::build_cover_url(pk, size)
|
||||
pmoupnp::cache_registry::build_cover_url(_pk, _size)
|
||||
.map_err(|e| MusicSourceError::CacheError(e.to_string()))
|
||||
}
|
||||
#[cfg(not(feature = "server"))]
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
env::var,
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
use bevy_reflect::Reflect;
|
||||
use xmltree::{Element, XMLNode};
|
||||
|
||||
use crate::actions::{Action, ActionData, ActionInstance, ArgInstanceSet};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use tracing::{info, trace};
|
||||
use tracing::info;
|
||||
use xmltree::{Element, XMLNode};
|
||||
|
||||
use crate::actions::{Action, ActionHandler, ActionInstance, Argument, ArgumentSet};
|
||||
|
||||
@@ -17,21 +17,3 @@ impl From<std::io::Error> for ActionError {
|
||||
ActionError::GeneralError(format!("IO error: {}", err))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum ArgumentError {
|
||||
#[error("Argument error: {0}")]
|
||||
GeneralError(String),
|
||||
|
||||
#[error("Argument error: {0}")]
|
||||
ArgumentError(String),
|
||||
|
||||
#[error("Set operation error: {0}")]
|
||||
SetError(String),
|
||||
}
|
||||
|
||||
impl From<std::io::Error> for ArgumentError {
|
||||
fn from(err: std::io::Error) -> Self {
|
||||
ArgumentError::GeneralError(format!("IO error: {}", err))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,21 +47,21 @@ impl UpnpObject for Service {
|
||||
elem.children.push(XMLNode::Element(service_id));
|
||||
|
||||
// SCPDURL
|
||||
let mut SCPDURL = Element::new("SCPDURL");
|
||||
SCPDURL.children.push(XMLNode::Text(self.scpd_route()));
|
||||
elem.children.push(XMLNode::Element(SCPDURL));
|
||||
let mut scpdurl = Element::new("SCPDURL");
|
||||
scpdurl.children.push(XMLNode::Text(self.scpd_route()));
|
||||
elem.children.push(XMLNode::Element(scpdurl));
|
||||
|
||||
// controlURL
|
||||
let mut controlURL = Element::new("controlURL");
|
||||
controlURL
|
||||
let mut control_url = Element::new("controlURL");
|
||||
control_url
|
||||
.children
|
||||
.push(XMLNode::Text(self.control_route()));
|
||||
elem.children.push(XMLNode::Element(controlURL));
|
||||
elem.children.push(XMLNode::Element(control_url));
|
||||
|
||||
// eventSubURL
|
||||
let mut eventSubURL = Element::new("eventSubURL");
|
||||
eventSubURL.children.push(XMLNode::Text(self.event_route()));
|
||||
elem.children.push(XMLNode::Element(eventSubURL));
|
||||
let mut event_sub_url = Element::new("eventSubURL");
|
||||
event_sub_url.children.push(XMLNode::Text(self.event_route()));
|
||||
elem.children.push(XMLNode::Element(event_sub_url));
|
||||
|
||||
elem
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@ edition = "2024"
|
||||
[dependencies]
|
||||
get_if_addrs = "0.5.3"
|
||||
os_info = "3.8"
|
||||
netstat2 = "0.9"
|
||||
netstat2 = "0.11.2"
|
||||
sysinfo = "0.30"
|
||||
users = "0.11"
|
||||
|
||||
Reference in New Issue
Block a user