diff --git a/spotify_player/Cargo.toml b/spotify_player/Cargo.toml index 58f012db..0b7f0c53 100644 --- a/spotify_player/Cargo.toml +++ b/spotify_player/Cargo.toml @@ -78,7 +78,7 @@ image = ["viuer", "dep:image"] sixel = ["image", "viuer/sixel"] notify = ["notify-rust"] clipboard = ["copypasta"] -daemon = ["daemonize"] +daemon = ["daemonize", "streaming"] default = ["rodio-backend", "media-control", "clipboard"] diff --git a/spotify_player/src/main.rs b/spotify_player/src/main.rs index e5647812..4e2ba1f0 100644 --- a/spotify_player/src/main.rs +++ b/spotify_player/src/main.rs @@ -283,10 +283,6 @@ fn main() -> Result<()> { eprintln!("Running the application as a daemon on windows/macos with `media-control` feature enabled is not supported!"); std::process::exit(1); } - if cfg!(not(feature = "streaming")) { - eprintln!("`streaming` feature must be enabled to run the application as a daemon!"); - std::process::exit(1); - } tracing::info!("Starting the application as a daemon..."); let daemonize = daemonize::Daemonize::new(); diff --git a/spotify_player/src/streaming.rs b/spotify_player/src/streaming.rs index 46396a70..19a00072 100644 --- a/spotify_player/src/streaming.rs +++ b/spotify_player/src/streaming.rs @@ -15,6 +15,28 @@ use librespot_playback::{ use rspotify::model::TrackId; use serde::Serialize; +#[cfg(not(any( + feature = "rodio-backend", + feature = "alsa-backend", + feature = "pulseaudio-backend", + feature = "portaudio-backend", + feature = "jackaudio-backend", + feature = "rodiojack-backend", + feature = "sdl-backend", + feature = "gstreamer-backend" +)))] +compile_error!("Streaming feature is enabled but no audio backend has been selected. Consider adding one of the following features: + rodio-backend, + alsa-backend, + pulseaudio-backend, + portaudio-backend, + jackaudio-backend, + rodiojack-backend, + sdl-backend, + gstreamer-backend +For more information, visit https://github.com/aome510/spotify-player?tab=readme-ov-file#streaming +"); + #[derive(Debug, Serialize)] enum PlayerEvent { Changed {