diff options
| author | Yuval Adam <_@yuv.al> | 2024-05-31 14:37:39 +0200 |
|---|---|---|
| committer | Yuval Adam <_@yuv.al> | 2024-05-31 14:37:56 +0200 |
| commit | 10976b7bdfcdb57724d9e2b1dedd2c172b0b5973 (patch) | |
| tree | d648d1aecbef73c199a8aa5950da881059d0e259 | |
| parent | 508e13150ab0398e2e5a8c2f64646c38d097a814 (diff) | |
Play stream from mpv with spinner
| -rw-r--r-- | Cargo.lock | 2 | ||||
| -rw-r--r-- | Cargo.toml | 2 | ||||
| -rw-r--r-- | src/main.rs | 11 |
3 files changed, 10 insertions, 5 deletions
@@ -955,7 +955,7 @@ dependencies = [ [[package]] name = "somafm" -version = "0.1.0" +version = "0.2.0" dependencies = [ "inquire", "reqwest", @@ -1,7 +1,7 @@ [package] name = "somafm" description = "A Rust-based command line player for SomaFM radio" -version = "0.1.0" +version = "0.2.0" authors = ["Yuval Adam <_@yuv.al>"] edition = "2021" license = "MIT" diff --git a/src/main.rs b/src/main.rs index 5f6fa28..aa9f938 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,7 @@ +use crate::channels::Channel; use inquire::{InquireError, Select}; use spinners::{Spinner, Spinners}; - -use crate::channels::Channel; +use std::process::Command; mod channels; @@ -15,7 +15,12 @@ fn main() { match ans { Ok(ch) => { - println!("{:?}", ch); + let _sp = Spinner::new(Spinners::Arrow3, format!("Playing {}", ch)); + let url = format!("https://api.somafm.com/{}.pls", ch.id); + Command::new("mpv") + .args([url]) + .output() + .expect("Failed to start mpv, make sure it is installed."); } Err(_e) => { println!("\nNo channel selected, exiting."); |
