pub struct Client { /* private fields */ }Expand description
General-purpose mpd client: “general-purpose” in the sense that we send commands through it; the interface is narrowly scoped to this program’s needs.
§Introduction
This is the primary abstraction of the MPD client protocol, written for the convenience of mpdpopm. Construct instances with a TCP socket, a Unix socket, or any RequestResponse implementation. You can then carry out assorted operations in the MPD client protocol by invoking its methods.
use std::path::Path;
use mpdpopm::clients::Client;
let client = Client::open(Path::new("/var/run/mpd.sock"));client is now a Future that
resolves to a Client instance talking to /var/run/mpd.sock.
use mpdpopm::clients::Client;
let client = Client::connect("localhost:6600");client is now a Future that
resolves to a Client instance talking TCP to the MPD server on localhost at port 6600.
Implementations§
Source§impl Client
impl Client
Sourcepub async fn status(&mut self) -> Result<PlayerStatus>
pub async fn status(&mut self) -> Result<PlayerStatus>
Retrieve the current server status.
Sourcepub async fn get_sticker<T: FromStr>(
&mut self,
file: &str,
sticker_name: &str,
) -> Result<Option<T>>
pub async fn get_sticker<T: FromStr>( &mut self, file: &str, sticker_name: &str, ) -> Result<Option<T>>
Retrieve a song sticker by name
Sourcepub async fn set_sticker<T: Display>(
&mut self,
file: &str,
sticker_name: &str,
sticker_value: &T,
) -> Result<()>
pub async fn set_sticker<T: Display>( &mut self, file: &str, sticker_name: &str, sticker_value: &T, ) -> Result<()>
Set a song sticker by name
Sourcepub async fn send_to_playlist(&mut self, file: &str, pl: &str) -> Result<()>
pub async fn send_to_playlist(&mut self, file: &str, pl: &str) -> Result<()>
Send a file to a playlist
Sourcepub async fn send_message(&mut self, chan: &str, msg: &str) -> Result<()>
pub async fn send_message(&mut self, chan: &str, msg: &str) -> Result<()>
Send an arbitrary message
Sourcepub async fn get_stored_playlists(&mut self) -> Result<Vec<String>>
pub async fn get_stored_playlists(&mut self) -> Result<Vec<String>>
Get the list of stored playlists
Sourcepub async fn find1(
&mut self,
cond: &str,
val: &str,
case: bool,
) -> Result<Vec<String>>
pub async fn find1( &mut self, cond: &str, val: &str, case: bool, ) -> Result<Vec<String>>
Search the database for songs matching filter (unary operator)
Set case to true to request a case-sensitive search (false yields case-insensitive)
Sourcepub async fn find2(
&mut self,
attr: &str,
op: &str,
val: &str,
case: bool,
) -> Result<Vec<String>>
pub async fn find2( &mut self, attr: &str, op: &str, val: &str, case: bool, ) -> Result<Vec<String>>
Search the database for songs matching filter (case-sensitive, binary operator)
Set case to true to request a case-sensitive search (false yields case-insensitive)
Sourcepub async fn get_stickers(
&mut self,
sticker: &str,
) -> Result<HashMap<String, String>>
pub async fn get_stickers( &mut self, sticker: &str, ) -> Result<HashMap<String, String>>
Retrieve all instances of a given sticker under the music directory
Return a mapping from song URI to textual sticker value
Sourcepub async fn get_all_songs(&mut self) -> Result<Vec<String>>
pub async fn get_all_songs(&mut self) -> Result<Vec<String>>
Retrieve the song URIs of all songs in the database
Returns a vector of String