Bump version to 0.3.18 and improve stream handling
Version bump from 0.3.17 to 0.3.18 - Updated version in Cargo.toml and version.txt - Removed unused LiveResponse import in pmoradiofrance - Added tracing info for stream proxyfication - Improved Media::best_hifi_stream logic to prioritize AAC over MP3 and never use HLS streams - Updated comments to reflect new stream priority logic
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -4,7 +4,7 @@ version = 4
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "PMOMusic"
|
name = "PMOMusic"
|
||||||
version = "0.3.17"
|
version = "0.3.18"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"axum 0.8.7",
|
"axum 0.8.7",
|
||||||
"console-subscriber",
|
"console-subscriber",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "PMOMusic"
|
name = "PMOMusic"
|
||||||
version = "0.3.17"
|
version = "0.3.18"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
//! Ce module définit les handlers HTTP pour accéder aux stations Radio France,
|
//! Ce module définit les handlers HTTP pour accéder aux stations Radio France,
|
||||||
//! leurs métadonnées live et les flux de streaming.
|
//! leurs métadonnées live et les flux de streaming.
|
||||||
|
|
||||||
use crate::models::LiveResponse;
|
|
||||||
use crate::playlist::StationGroups;
|
use crate::playlist::StationGroups;
|
||||||
use crate::pmoserver_ext::RadioFranceState;
|
use crate::pmoserver_ext::RadioFranceState;
|
||||||
use axum::{
|
use axum::{
|
||||||
@@ -16,6 +15,7 @@ use axum::{
|
|||||||
};
|
};
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use serde_json;
|
use serde_json;
|
||||||
|
use tracing::info;
|
||||||
|
|
||||||
// ============ Gestion des erreurs ============
|
// ============ Gestion des erreurs ============
|
||||||
|
|
||||||
@@ -97,6 +97,11 @@ async fn proxy_stream(
|
|||||||
Err(e) => return AppError(format!("Stream not found: {}", e)).into_response(),
|
Err(e) => return AppError(format!("Stream not found: {}", e)).into_response(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
info!(
|
||||||
|
"Proxyfying RadioFrance stream for {} ==> {}",
|
||||||
|
&slug, &stream_url
|
||||||
|
);
|
||||||
|
|
||||||
// Connect to the Radio France stream
|
// Connect to the Radio France stream
|
||||||
let response = match reqwest::get(&stream_url).await {
|
let response = match reqwest::get(&stream_url).await {
|
||||||
Ok(r) => r,
|
Ok(r) => r,
|
||||||
|
|||||||
@@ -158,20 +158,21 @@ pub struct Media {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Media {
|
impl Media {
|
||||||
/// Find the best HiFi stream (AAC 192 kbps or HLS)
|
/// Find the best HiFi stream (AAC ou MP3, bitrate maximum, jamais HLS)
|
||||||
pub fn best_hifi_stream(&self) -> Option<&StreamSource> {
|
pub fn best_hifi_stream(&self) -> Option<&StreamSource> {
|
||||||
// Priority: AAC 192 kbps > HLS
|
// Priority: AAC 192 kbps > AAC autre bitrate > MP3 bitrate max > autre
|
||||||
|
// JAMAIS HLS (incompatible avec beaucoup de lecteurs)
|
||||||
self.sources
|
self.sources
|
||||||
.iter()
|
.iter()
|
||||||
.find(|s| {
|
.filter(|s| s.broadcast_type == BroadcastType::Live && s.format != StreamFormat::Hls)
|
||||||
s.format == StreamFormat::Aac
|
.max_by_key(|s| {
|
||||||
&& s.broadcast_type == BroadcastType::Live
|
// Priorité: format puis bitrate
|
||||||
&& s.bitrate == 192
|
let format_priority = match s.format {
|
||||||
})
|
StreamFormat::Aac => 1000,
|
||||||
.or_else(|| {
|
StreamFormat::Mp3 => 500,
|
||||||
self.sources.iter().find(|s| {
|
StreamFormat::Hls => 0, // Filtré de toute façon
|
||||||
s.format == StreamFormat::Hls && s.broadcast_type == BroadcastType::Live
|
};
|
||||||
})
|
format_priority + s.bitrate
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
0.3.17
|
0.3.18
|
||||||
|
|||||||
Reference in New Issue
Block a user