diff options
| author | krolxon <krolyxon@tutanota.com> | 2024-04-24 13:56:53 +0530 |
|---|---|---|
| committer | krolxon <krolyxon@tutanota.com> | 2024-04-24 13:56:53 +0530 |
| commit | 044101b29091eab34f5bb11ad8929db266826705 (patch) | |
| tree | b6d2c05daa0ccd182a9d139773f6901af3cba662 /src/connection.rs | |
| parent | 3f6b2bfefd54a53e675e0cffc98b704d3b8ad244 (diff) | |
handle seek forwards/backwords
Diffstat (limited to 'src/connection.rs')
| -rwxr-xr-x | src/connection.rs | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/connection.rs b/src/connection.rs index fa8cc78..16055a5 100755 --- a/src/connection.rs +++ b/src/connection.rs @@ -10,7 +10,7 @@ pub type Error = Box<dyn std::error::Error>; pub struct Connection { pub conn: Client, pub songs_filenames: Vec<String>, - // pub state: String, + pub state: String, } impl Connection { @@ -27,7 +27,7 @@ impl Connection { Ok(Self { conn, songs_filenames, - // state: "Stopped".to_string(), + state: "Stopped".to_string(), }) } @@ -55,13 +55,14 @@ impl Connection { Ok(()) } - // pub fn update_state(&mut self) { - // match self.conn.status().unwrap().state { - // State::Stop => self.state = "Stopped".to_string(), - // State::Play => self.state = "Playing".to_string(), - // State::Pause => self.state = "Paused".to_string(), - // } - // } + pub fn update_state(&mut self) -> String { + match self.conn.status().unwrap().state { + State::Stop => self.state = "Stopped".to_string(), + State::Play => self.state = "Playing".to_string(), + State::Pause => self.state = "Paused".to_string(), + } + self.state.clone() + } /// push the given song to queue pub fn push(&mut self, song: &Song) -> Result<()> { @@ -136,7 +137,7 @@ impl Connection { let song = self.conn.currentsong()?.unwrap_or_default(); if let Some(s) = song.title { if let Some(a) = song.artist { - return Ok(Some(format!("{} - {}", s, a))); + return Ok(Some(format!("\"{}\" By {}", a, s))); } else { return Ok(Some(s)); } |
