From 5149723b5c00789fa19003b13c5808829c6f8587 Mon Sep 17 00:00:00 2001 From: Tal <83217276+talwat@users.noreply.github.com> Date: Thu, 26 Sep 2024 16:13:40 +0200 Subject: [PATCH] feat: remove play command --- README.md | 3 +++ src/main.rs | 21 +++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 628e80e..dbaf093 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,6 @@ It'll do this as simply as it can: no albums, no ads, just lofi. I really hate modern music platforms, and I wanted a small, "suckless" app that would literally just play lofi without video so I could use it whenever. + +I also wanted it to be fairly resiliant to inconsistent networks, +so it buffers 5 whole songs at a time instead of parts of the same song. diff --git a/src/main.rs b/src/main.rs index c0403de..97b0e28 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,7 +10,7 @@ mod tracks; #[command(about)] struct Args { #[command(subcommand)] - command: Commands, + command: Option, } #[derive(Subcommand)] @@ -24,20 +24,21 @@ enum Commands { /// Whether to include the full HTTP URL or just the distinguishing part. #[clap(long, short)] include_full: bool, - }, - /// Starts the player. - Play, + } } #[tokio::main] async fn main() -> eyre::Result<()> { let cli = Args::parse(); - match cli.command { - Commands::Scrape { - extention, - include_full, - } => scrape::scrape(extention, include_full).await, - Commands::Play => play::play().await, + if let Some(command) = cli.command { + match command { + Commands::Scrape { + extention, + include_full, + } => scrape::scrape(extention, include_full).await + } + } else { + play::play().await } }