aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/connection.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/connection.rs b/src/connection.rs
index 71db995..96545de 100755
--- a/src/connection.rs
+++ b/src/connection.rs
@@ -1,7 +1,6 @@
use mpd::song::Song;
-use mpd::Client;
+use mpd::{Client, State};
use simple_dmenu::dmenu;
-use std::process::Command;
pub struct Connection {
pub conn: Client,
@@ -37,12 +36,14 @@ impl Connection {
}
fn push(&mut self, song: &Song) {
- self.conn.push(song).unwrap();
if self.conn.queue().unwrap().is_empty() {
self.conn.push(song).unwrap();
self.conn.play().unwrap();
} else {
self.conn.push(song).unwrap();
+ if self.conn.status().unwrap().state == State::Stop {
+ self.conn.play().unwrap();
+ }
self.conn.next().unwrap();
}
}