Changement du mécanisme d'attention sur les channels Radio Paradise.
This commit is contained in:
@@ -82,10 +82,7 @@ pub async fn get_cover_url(
|
||||
Ok(Some(cover_pk)) if !cover_pk.is_empty() => (cover_pk, "cover_pk".to_string()),
|
||||
_ => match metadata_guard.get_cover_url().await {
|
||||
Ok(Some(url)) if !url.is_empty() => (url, "cover_url".to_string()),
|
||||
_ => (
|
||||
pmometadata::get_default_cover_url(),
|
||||
"default".to_string(),
|
||||
),
|
||||
_ => (pmometadata::get_default_cover_url(), "default".to_string()),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
//! spécifiques aux fichiers audio : conversion FLAC automatique et stockage
|
||||
//! des métadonnées en JSON dans la base de données.
|
||||
|
||||
use anyhow::Result;
|
||||
use crate::metadata_ext::AudioTrackMetadataExt;
|
||||
use pmocache::CacheConfig;
|
||||
use anyhow::Result;
|
||||
use pmocache::download::TransformMetadata;
|
||||
use pmocache::CacheConfig;
|
||||
use serde_json::Value;
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -277,8 +277,7 @@ fn parse_flac_streaminfo(data: &[u8]) -> Option<(u32, u8, u64)> {
|
||||
let s = &data[8..8 + 34];
|
||||
|
||||
// sample_rate: 20 bits: bytes 10..12
|
||||
let sample_rate =
|
||||
((s[10] as u32) << 12) | ((s[11] as u32) << 4) | ((s[12] as u32 & 0xF0) >> 4);
|
||||
let sample_rate = ((s[10] as u32) << 12) | ((s[11] as u32) << 4) | ((s[12] as u32 & 0xF0) >> 4);
|
||||
|
||||
// bits_per_sample: 5 bits spanning byte 12 (lsb) and byte 13 (msb)
|
||||
let bps_raw = (((s[12] & 0x01) as u8) << 4) | ((s[13] & 0xF0) >> 4);
|
||||
|
||||
@@ -231,7 +231,7 @@ impl AudioCacheExt for pmoserver::Server {
|
||||
"/{pk}/cover-url",
|
||||
axum::routing::get(crate::api::get_cover_url),
|
||||
)
|
||||
.with_state(cache.clone())
|
||||
.with_state(cache.clone()),
|
||||
);
|
||||
|
||||
let openapi = crate::ApiDoc::openapi();
|
||||
|
||||
@@ -124,9 +124,24 @@ impl TrackMetadataDidlExt for dyn TrackMetadata {
|
||||
pmodidl::Resource {
|
||||
// Aligne sur Sink du renderer (audio/flac) avec PN explicite.
|
||||
protocol_info: "http-get:*:audio/flac:DLNA.ORG_PN=FLAC".to_string(),
|
||||
bits_per_sample: self.get_bits_per_sample().await.ok().flatten().map(|b| b.to_string()),
|
||||
sample_frequency: self.get_sample_rate().await.ok().flatten().map(|sr| sr.to_string()),
|
||||
nr_audio_channels: self.get_channels().await.ok().flatten().map(|ch| ch.to_string()),
|
||||
bits_per_sample: self
|
||||
.get_bits_per_sample()
|
||||
.await
|
||||
.ok()
|
||||
.flatten()
|
||||
.map(|b| b.to_string()),
|
||||
sample_frequency: self
|
||||
.get_sample_rate()
|
||||
.await
|
||||
.ok()
|
||||
.flatten()
|
||||
.map(|sr| sr.to_string()),
|
||||
nr_audio_channels: self
|
||||
.get_channels()
|
||||
.await
|
||||
.ok()
|
||||
.flatten()
|
||||
.map(|ch| ch.to_string()),
|
||||
duration,
|
||||
url,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user