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]]
|
||||
name = "PMOMusic"
|
||||
version = "0.3.17"
|
||||
version = "0.3.18"
|
||||
dependencies = [
|
||||
"axum 0.8.7",
|
||||
"console-subscriber",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "PMOMusic"
|
||||
version = "0.3.17"
|
||||
version = "0.3.18"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
//! Ce module définit les handlers HTTP pour accéder aux stations Radio France,
|
||||
//! leurs métadonnées live et les flux de streaming.
|
||||
|
||||
use crate::models::LiveResponse;
|
||||
use crate::playlist::StationGroups;
|
||||
use crate::pmoserver_ext::RadioFranceState;
|
||||
use axum::{
|
||||
@@ -16,6 +15,7 @@ use axum::{
|
||||
};
|
||||
use futures::StreamExt;
|
||||
use serde_json;
|
||||
use tracing::info;
|
||||
|
||||
// ============ Gestion des erreurs ============
|
||||
|
||||
@@ -97,6 +97,11 @@ async fn proxy_stream(
|
||||
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
|
||||
let response = match reqwest::get(&stream_url).await {
|
||||
Ok(r) => r,
|
||||
|
||||
@@ -158,20 +158,21 @@ pub struct 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> {
|
||||
// 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
|
||||
.iter()
|
||||
.find(|s| {
|
||||
s.format == StreamFormat::Aac
|
||||
&& s.broadcast_type == BroadcastType::Live
|
||||
&& s.bitrate == 192
|
||||
})
|
||||
.or_else(|| {
|
||||
self.sources.iter().find(|s| {
|
||||
s.format == StreamFormat::Hls && s.broadcast_type == BroadcastType::Live
|
||||
})
|
||||
.filter(|s| s.broadcast_type == BroadcastType::Live && s.format != StreamFormat::Hls)
|
||||
.max_by_key(|s| {
|
||||
// Priorité: format puis bitrate
|
||||
let format_priority = match s.format {
|
||||
StreamFormat::Aac => 1000,
|
||||
StreamFormat::Mp3 => 500,
|
||||
StreamFormat::Hls => 0, // Filtré de toute façon
|
||||
};
|
||||
format_priority + s.bitrate
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
0.3.17
|
||||
0.3.18
|
||||
|
||||
Reference in New Issue
Block a user