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 /src/main.rs | |
| parent | 508e13150ab0398e2e5a8c2f64646c38d097a814 (diff) | |
Play stream from mpv with spinner
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 11 |
1 files changed, 8 insertions, 3 deletions
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."); |
