diff options
| author | salmonik <raisersoft@proton.me> | 2026-05-27 20:26:56 +0200 |
|---|---|---|
| committer | salmonik <raisersoft@proton.me> | 2026-05-27 20:26:56 +0200 |
| commit | 09c78a14cb7dc83c7711b6e58025d43272e9eaf7 (patch) | |
| tree | e5eec691695c3beff320a2a2a9c2d60c2524ec55 /src/cli.rs | |
| parent | add licensing (diff) | |
| download | rsplayer-09c78a14cb7dc83c7711b6e58025d43272e9eaf7.tar.gz rsplayer-09c78a14cb7dc83c7711b6e58025d43272e9eaf7.zip | |
play [track] [-a/--album] option
if supplied when a track is played, the rest of the album will be queued
after the track
Diffstat (limited to 'src/cli.rs')
| -rw-r--r-- | src/cli.rs | 15 |
1 files changed, 13 insertions, 2 deletions
| @@ -35,6 +35,9 @@ pub enum Commands { | |||
| 35 | /// Add to queue after current track (don't skip) | 35 | /// Add to queue after current track (don't skip) |
| 36 | #[arg(short = 'n', long = "next")] | 36 | #[arg(short = 'n', long = "next")] |
| 37 | next: bool, | 37 | next: bool, |
| 38 | /// Queue rest of album after this track (requires a track query) | ||
| 39 | #[arg(short = 'a', long = "album")] | ||
| 40 | album: bool, | ||
| 38 | #[arg(value_name = "QUERY")] | 41 | #[arg(value_name = "QUERY")] |
| 39 | query: Option<String>, | 42 | query: Option<String>, |
| 40 | }, | 43 | }, |
| @@ -129,7 +132,11 @@ impl Cli { | |||
| 129 | crate::daemon::restart_daemon()?; | 132 | crate::daemon::restart_daemon()?; |
| 130 | } | 133 | } |
| 131 | Commands::Play { | 134 | Commands::Play { |
| 132 | now, next, query, .. | 135 | now, |
| 136 | next, | ||
| 137 | album, | ||
| 138 | query, | ||
| 139 | .. | ||
| 133 | } => { | 140 | } => { |
| 134 | if let Some(q) = query { | 141 | if let Some(q) = query { |
| 135 | let pos = if *now { | 142 | let pos = if *now { |
| @@ -139,7 +146,11 @@ impl Cli { | |||
| 139 | } else { | 146 | } else { |
| 140 | "last" | 147 | "last" |
| 141 | }; | 148 | }; |
| 142 | crate::daemon::send_command(format!("play {} {}", pos, q))?; | 149 | if *album { |
| 150 | crate::daemon::send_command(format!("play-album {} {}", pos, q))?; | ||
| 151 | } else { | ||
| 152 | crate::daemon::send_command(format!("play {} {}", pos, q))?; | ||
| 153 | } | ||
| 143 | } else { | 154 | } else { |
| 144 | crate::daemon::send_command("play last".to_string())?; | 155 | crate::daemon::send_command("play last".to_string())?; |
| 145 | } | 156 | } |
