2025-11-05 07:40:36 +00:00
|
|
|
//! DEPRECATED: Stub implementation of RadioParadiseSource
|
2025-10-16 22:00:35 +02:00
|
|
|
//!
|
2025-11-05 07:40:36 +00:00
|
|
|
//! **⚠️ This module is deprecated and will be removed in a future version.**
|
|
|
|
|
//!
|
|
|
|
|
//! The orchestration-based RadioParadiseSource has been replaced by
|
|
|
|
|
//! `RadioParadiseStreamSource`, which integrates directly with the pmoaudio
|
|
|
|
|
//! pipeline for streaming and decoding.
|
|
|
|
|
//!
|
|
|
|
|
//! ## Migration Guide
|
|
|
|
|
//!
|
|
|
|
|
//! **Old approach** (deprecated):
|
|
|
|
|
//! ```rust,ignore
|
|
|
|
|
//! use pmoparadise::RadioParadiseSource;
|
|
|
|
|
//! let source = RadioParadiseSource::from_registry(client)?;
|
|
|
|
|
//! ```
|
|
|
|
|
//!
|
|
|
|
|
//! **New approach** (recommended):
|
|
|
|
|
//! ```rust,ignore
|
|
|
|
|
//! use pmoparadise::RadioParadiseStreamSource;
|
|
|
|
|
//! use pmoaudio::pipeline::Node;
|
|
|
|
|
//!
|
|
|
|
|
//! let stream_source = RadioParadiseStreamSource::new(client, None).await?;
|
|
|
|
|
//! let node = Node::from_logic(stream_source);
|
|
|
|
|
//! // Use node in pmoaudio pipeline
|
|
|
|
|
//! ```
|
|
|
|
|
//!
|
|
|
|
|
//! This stub implementation is provided only for backward compatibility with
|
|
|
|
|
//! existing code (e.g., pmomediaserver) until it can be updated to use
|
|
|
|
|
//! RadioParadiseStreamSource.
|
2025-10-16 22:00:35 +02:00
|
|
|
|
2025-10-16 22:13:00 +02:00
|
|
|
use crate::client::RadioParadiseClient;
|
2025-11-05 07:40:36 +00:00
|
|
|
use pmosource::pmodidl::{Container, Item};
|
|
|
|
|
use pmosource::{async_trait, BrowseResult, MusicSource, MusicSourceError, Result};
|
2025-10-16 22:13:00 +02:00
|
|
|
use std::time::SystemTime;
|
2025-10-16 22:00:35 +02:00
|
|
|
|
2025-11-05 07:40:36 +00:00
|
|
|
/// Default Radio Paradise image (embedded in binary)
|
2025-10-16 22:00:35 +02:00
|
|
|
const DEFAULT_IMAGE: &[u8] = include_bytes!("../assets/default.webp");
|
|
|
|
|
|
2025-11-05 07:40:36 +00:00
|
|
|
/// DEPRECATED: Stub implementation of RadioParadiseSource
|
|
|
|
|
///
|
|
|
|
|
/// This is a minimal stub that implements the MusicSource trait with no-op
|
|
|
|
|
/// implementations. It exists only to maintain API compatibility during the
|
|
|
|
|
/// migration to RadioParadiseStreamSource.
|
|
|
|
|
///
|
|
|
|
|
/// **Do not use this in new code.** Use `RadioParadiseStreamSource` instead.
|
|
|
|
|
#[derive(Clone, Debug)]
|
2025-10-16 22:13:00 +02:00
|
|
|
pub struct RadioParadiseSource {
|
2025-11-05 07:40:36 +00:00
|
|
|
_client: RadioParadiseClient,
|
2025-10-16 22:13:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl RadioParadiseSource {
|
2025-11-05 07:40:36 +00:00
|
|
|
/// DEPRECATED: Create a new RadioParadiseSource from registry
|
|
|
|
|
///
|
|
|
|
|
/// This method is deprecated and will always return an error indicating
|
|
|
|
|
/// that the orchestration-based source is no longer supported.
|
|
|
|
|
///
|
|
|
|
|
/// Use `RadioParadiseStreamSource` instead for audio streaming.
|
2025-10-18 09:58:39 +02:00
|
|
|
#[cfg(feature = "server")]
|
2025-11-05 07:40:36 +00:00
|
|
|
pub fn from_registry(_client: RadioParadiseClient) -> Result<Self> {
|
|
|
|
|
Err(MusicSourceError::SourceUnavailable(
|
2025-11-14 10:43:53 +01:00
|
|
|
"RadioParadiseSource is deprecated. Use RadioParadiseStreamSource instead.".to_string(),
|
2025-11-05 07:40:36 +00:00
|
|
|
))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// DEPRECATED: Create a new RadioParadiseSource from registry with defaults
|
|
|
|
|
///
|
|
|
|
|
/// This method creates a stub instance that will log deprecation warnings
|
|
|
|
|
/// but allows existing code to compile.
|
|
|
|
|
///
|
|
|
|
|
/// Use `RadioParadiseStreamSource` instead for audio streaming.
|
2025-10-18 09:58:39 +02:00
|
|
|
#[cfg(feature = "server")]
|
2025-11-05 07:40:36 +00:00
|
|
|
pub fn from_registry_default(client: RadioParadiseClient) -> Self {
|
|
|
|
|
tracing::warn!(
|
|
|
|
|
"RadioParadiseSource::from_registry_default is deprecated. \
|
|
|
|
|
Use RadioParadiseStreamSource for audio streaming."
|
|
|
|
|
);
|
|
|
|
|
Self { _client: client }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// DEPRECATED: Create a new RadioParadiseSource with default settings
|
|
|
|
|
///
|
|
|
|
|
/// This method is deprecated and only exists for API compatibility.
|
|
|
|
|
pub fn new_default(client: RadioParadiseClient) -> Self {
|
|
|
|
|
tracing::warn!(
|
|
|
|
|
"RadioParadiseSource::new_default is deprecated. \
|
|
|
|
|
Use RadioParadiseStreamSource for audio streaming."
|
|
|
|
|
);
|
|
|
|
|
Self { _client: client }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// DEPRECATED: Create a new RadioParadiseSource with cache
|
|
|
|
|
///
|
|
|
|
|
/// This method is deprecated and only exists for API compatibility.
|
|
|
|
|
pub fn new_with_cache(client: RadioParadiseClient, _cache_size: usize) -> Self {
|
|
|
|
|
tracing::warn!(
|
|
|
|
|
"RadioParadiseSource::new_with_cache is deprecated. \
|
|
|
|
|
Use RadioParadiseStreamSource for audio streaming."
|
|
|
|
|
);
|
|
|
|
|
Self { _client: client }
|
2025-10-16 22:13:00 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[async_trait]
|
2025-10-16 22:00:35 +02:00
|
|
|
impl MusicSource for RadioParadiseSource {
|
|
|
|
|
fn name(&self) -> &str {
|
2025-11-05 07:40:36 +00:00
|
|
|
"Radio Paradise (DEPRECATED)"
|
2025-10-16 22:00:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn id(&self) -> &str {
|
2025-11-05 07:40:36 +00:00
|
|
|
"radio-paradise-deprecated"
|
2025-10-16 22:00:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn default_image(&self) -> &[u8] {
|
|
|
|
|
DEFAULT_IMAGE
|
|
|
|
|
}
|
2025-10-16 22:13:00 +02:00
|
|
|
|
|
|
|
|
async fn root_container(&self) -> Result<Container> {
|
2025-11-05 07:40:36 +00:00
|
|
|
Ok(Container {
|
|
|
|
|
id: "radio-paradise-deprecated".to_string(),
|
|
|
|
|
parent_id: "0".to_string(),
|
|
|
|
|
restricted: Some("1".to_string()),
|
|
|
|
|
child_count: Some("0".to_string()),
|
|
|
|
|
searchable: Some("0".to_string()),
|
|
|
|
|
title: "Radio Paradise (DEPRECATED)".to_string(),
|
|
|
|
|
class: "object.container".to_string(),
|
|
|
|
|
containers: vec![],
|
|
|
|
|
items: vec![],
|
|
|
|
|
})
|
2025-10-16 22:13:00 +02:00
|
|
|
}
|
|
|
|
|
|
2025-11-05 07:40:36 +00:00
|
|
|
async fn browse(&self, _object_id: &str) -> Result<BrowseResult> {
|
|
|
|
|
tracing::warn!("RadioParadiseSource::browse called but source is deprecated");
|
|
|
|
|
Ok(BrowseResult::Mixed {
|
|
|
|
|
containers: vec![],
|
|
|
|
|
items: vec![],
|
|
|
|
|
})
|
2025-10-16 22:13:00 +02:00
|
|
|
}
|
|
|
|
|
|
2025-11-05 07:40:36 +00:00
|
|
|
async fn resolve_uri(&self, _object_id: &str) -> Result<String> {
|
|
|
|
|
Err(MusicSourceError::SourceUnavailable(
|
2025-11-14 10:43:53 +01:00
|
|
|
"RadioParadiseSource is deprecated. Use RadioParadiseStreamSource instead.".to_string(),
|
2025-11-05 07:40:36 +00:00
|
|
|
))
|
2025-10-16 22:13:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn supports_fifo(&self) -> bool {
|
2025-10-19 18:14:28 +02:00
|
|
|
false
|
|
|
|
|
}
|
2025-10-16 22:13:00 +02:00
|
|
|
|
2025-10-19 18:14:28 +02:00
|
|
|
async fn append_track(&self, _track: Item) -> Result<()> {
|
2025-11-05 07:40:36 +00:00
|
|
|
Err(MusicSourceError::SourceUnavailable(
|
2025-11-14 10:43:53 +01:00
|
|
|
"RadioParadiseSource is deprecated and does not support FIFO operations.".to_string(),
|
2025-11-05 07:40:36 +00:00
|
|
|
))
|
2025-10-16 22:13:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async fn remove_oldest(&self) -> Result<Option<Item>> {
|
2025-11-05 07:40:36 +00:00
|
|
|
Ok(None)
|
2025-10-16 22:13:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async fn update_id(&self) -> u32 {
|
2025-11-05 07:40:36 +00:00
|
|
|
0
|
2025-10-16 22:13:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async fn last_change(&self) -> Option<SystemTime> {
|
2025-11-05 07:40:36 +00:00
|
|
|
None
|
2025-10-21 14:21:17 +02:00
|
|
|
}
|
|
|
|
|
|
2025-11-05 07:40:36 +00:00
|
|
|
async fn get_items(&self, _offset: usize, _count: usize) -> Result<Vec<Item>> {
|
|
|
|
|
Ok(vec![])
|
2025-10-17 08:19:10 +02:00
|
|
|
}
|
2025-10-16 22:00:35 +02:00
|
|
|
}
|