Implémentation de l'API REST De PMOControl.

This commit is contained in:
2025-12-03 18:59:41 +01:00
parent 825254a2bb
commit 72bf73ef10
21 changed files with 3383 additions and 728 deletions

View File

@@ -6,7 +6,8 @@ use axum::{
};
use std::{
collections::HashMap,
sync::{Arc, RwLock}, time::Duration,
sync::{Arc, RwLock},
time::Duration,
};
use tracing::info;
use xmltree::{Element, EmitterConfig, XMLNode};

View File

@@ -125,7 +125,6 @@ pub struct ServiceInstance {
seqid: Arc<Mutex<HashMap<String, u32>>>,
}
impl std::fmt::Debug for ServiceInstance {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("ServiceInstance")

View File

@@ -29,7 +29,6 @@ fn build_soap_envelope_with_body(body_child: Element) -> Result<String, xmltree:
Ok(String::from_utf8(buf).unwrap())
}
/// Construit une réponse SOAP UPnP
///
/// # Arguments

View File

@@ -53,7 +53,7 @@ mod envelope;
mod fault;
mod parser;
pub use builder::{build_soap_response,build_soap_request};
pub use builder::{build_soap_request, build_soap_response};
pub use envelope::{SoapBody, SoapEnvelope, SoapHeader};
pub use fault::{SoapFault, build_soap_fault};
pub use parser::{SoapAction, parse_soap_action, parse_soap_envelope};

View File

@@ -1,4 +1,4 @@
/*!
/*!
The PMOMusic SSDP client is a *control point*.
It must **not** bind to UDP port 1900.
@@ -184,11 +184,7 @@ fn parse_message(data: &str, from: SocketAddr) -> Option<SsdpEvent> {
};
if result.is_none() {
trace!(
"SSDP message from {} could not be parsed:\n{}",
from,
data
);
trace!("SSDP message from {} could not be parsed:\n{}", from, data);
}
result
@@ -247,7 +243,10 @@ fn handle_search_response(
let st = match headers.get("ST") {
Some(s) => s.to_string(),
None => {
trace!("M-SEARCH response from {} missing ST header, ignoring", from);
trace!(
"M-SEARCH response from {} missing ST header, ignoring",
from
);
return None;
}
};
@@ -350,8 +349,7 @@ fn parse_max_age(value: Option<&String>) -> u32 {
}
trace!(
"Could not parse max-age from CACHE-CONTROL: '{}', using default {}",
v,
MAX_AGE
v, MAX_AGE
);
}
MAX_AGE

View File

@@ -290,7 +290,7 @@ impl UpnpServerExt for Server {
limit: usize,
) -> Result<Arc<CoverCache>, anyhow::Error> {
// Délègue à l'implémentation pmocovers (qui enregistre WebP + JPEG + API)
let cache = pmocovers::CoverCacheExt::init_cover_cache(self, cache_dir, limit).await?;
Ok(cache)
}