From fd371e896096b03bc5efa7dc59963cbba0c334e7 Mon Sep 17 00:00:00 2001 From: krolxon Date: Sun, 28 Apr 2024 19:21:23 +0530 Subject: use mpd's load() to load playlists --- src/connection.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'src/connection.rs') diff --git a/src/connection.rs b/src/connection.rs index a929385..1ec76ae 100755 --- a/src/connection.rs +++ b/src/connection.rs @@ -160,16 +160,9 @@ impl Connection { } /// Push all songs of a playlist into queue - pub fn push_playlist(&mut self, playlist: &str) -> Result<()> { - let songs: Vec = self.conn.playlist(playlist)?; - - for song in songs { - if self.songs_filenames.contains(&song.file) { - let song = self.get_song_with_only_filename(&song.file); - self.conn.push(&song)?; - self.conn.play()?; - } - } + pub fn load_playlist(&mut self, playlist: &str) -> Result<()> { + self.conn.load(playlist, ..)?; + self.conn.play()?; Ok(()) } -- cgit v1.2.3