diff --git a/src/main.rs b/src/main.rs index a863147..610eab9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,6 +17,10 @@ struct Args { #[clap(long, short)] minimalist: bool, + /// Whether to start lowfi paused + #[clap(long, short)] + paused: bool, + /// The command that was ran. /// This is [None] if no command was specified. #[command(subcommand)] diff --git a/src/play.rs b/src/play.rs index c1f5d5c..1946392 100644 --- a/src/play.rs +++ b/src/play.rs @@ -74,7 +74,7 @@ pub async fn play(args: Args) -> eyre::Result<()> { let properties = InitialProperties::load().await?; let (tx, rx) = mpsc::channel(8); - let player = Arc::new(Player::new(!args.alternate).await?); + let player = Arc::new(Player::new(!args.alternate, &args).await?); let ui = task::spawn(ui::start(Arc::clone(&player), tx.clone(), args)); tx.send(Messages::Init).await?; diff --git a/src/player.rs b/src/player.rs index 00fff24..07d63cf 100644 --- a/src/player.rs +++ b/src/player.rs @@ -21,6 +21,7 @@ use tokio::{ use crate::{ play::InitialProperties, tracks::{DecodedTrack, Track, TrackInfo}, + Args, }; pub mod downloader; @@ -141,7 +142,7 @@ impl Player { /// `silent` can control whether alsa's output should be redirected, /// but this option is only applicable on Linux, as on MacOS & Windows /// it will never be silent. - pub async fn new(silent: bool) -> eyre::Result { + pub async fn new(silent: bool, args: &Args) -> eyre::Result { let (_stream, handle) = if silent && cfg!(target_os = "linux") { Self::silent_get_output_stream()? } else { @@ -149,6 +150,9 @@ impl Player { }; let sink = Sink::try_new(&handle)?; + if args.paused { + sink.pause(); + } let player = Self { tracks: RwLock::new(VecDeque::with_capacity(5)),