Struct mpd::client::Client [] [src]

pub struct Client<S = TcpStream> where S: Read + Write {
    pub version: Version,
    // some fields omitted
}

Client connection

Fields

version: Version

MPD version

Methods

impl Client<TcpStream>
[src]

fn connect<A: ToSocketAddrs>(addr: A) -> Result<Client<TcpStream>>

Connect client to some IP address

impl<S: Read + Write> Client<S>
[src]

fn new(socket: S) -> Result<Client<S>>

Create client from some arbitrary pre-connected socket

fn status(&mut self) -> Result<Status>

Get MPD status

fn stats(&mut self) -> Result<Stats>

Get MPD playing statistics

fn clearerror(&mut self) -> Result<()>

Clear error state

fn volume(&mut self, volume: i8) -> Result<()>

Set volume

fn repeat(&mut self, value: bool) -> Result<()>

Set repeat state

fn random(&mut self, value: bool) -> Result<()>

Set random state

fn single(&mut self, value: bool) -> Result<()>

Set single state

fn consume(&mut self, value: bool) -> Result<()>

Set consume state

fn crossfade<T: ToSeconds>(&mut self, value: T) -> Result<()>

Set crossfade time in seconds

fn mixrampdb(&mut self, value: f32) -> Result<()>

Set mixramp level in dB

fn mixrampdelay<T: ToSeconds>(&mut self, value: T) -> Result<()>

Set mixramp delay in seconds

fn replaygain(&mut self, gain: ReplayGain) -> Result<()>

Set replay gain mode

fn play(&mut self) -> Result<()>

Start playback

fn switch<T: ToQueuePlace>(&mut self, place: T) -> Result<()>

Start playback from given song in a queue

fn next(&mut self) -> Result<()>

Switch to a next song in queue

fn prev(&mut self) -> Result<()>

Switch to a previous song in queue

fn stop(&mut self) -> Result<()>

Stop playback

fn pause(&mut self, value: bool) -> Result<()>

Set pause state

fn seek<T: ToSeconds, P: ToQueuePlace>(&mut self, place: P, pos: T) -> Result<()>

Seek to a given place (in seconds) in a given song

fn rewind<T: ToSeconds>(&mut self, pos: T) -> Result<()>

Seek to a given place (in seconds) in the current song

fn songs<T: ToQueueRangeOrPlace>(&mut self, pos: T) -> Result<Vec<Song>>

List given song or range of songs in a play queue

fn queue(&mut self) -> Result<Vec<Song>>

List all songs in a play queue

fn currentsong(&mut self) -> Result<Option<Song>>

Get current playing song

fn clear(&mut self) -> Result<()>

Clear current queue

fn changes(&mut self, version: u32) -> Result<Vec<Song>>

List all changes in a queue since given version

fn push<P: AsRef<str>>(&mut self, path: P) -> Result<Id>

Append a song into a queue

fn insert<P: AsRef<str>>(&mut self, path: P, pos: usize) -> Result<usize>

Insert a song into a given position in a queue

fn delete<T: ToQueueRangeOrPlace>(&mut self, pos: T) -> Result<()>

Delete a song (at some position) or several songs (in a range) from a queue

fn shift<T: ToQueueRangeOrPlace>(&mut self, from: T, to: usize) -> Result<()>

Move a song (at a some position) or several songs (in a range) to other position in queue

fn swap<T: ToQueuePlace>(&mut self, one: T, two: T) -> Result<()>

Swap to songs in a queue

fn shuffle<T: ToQueueRange>(&mut self, range: T) -> Result<()>

Shuffle queue in a given range (use .. to shuffle full queue)

fn priority<T: ToQueueRangeOrPlace>(&mut self, pos: T, prio: u8) -> Result<()>

Set song priority in a queue

fn range<T: ToSongId, R: ToSongRange>(&mut self, song: T, range: R) -> Result<()>

Set song range (in seconds) to play

Doesn't work for currently playing song.

fn tag<T: ToSongId>(&mut self, song: T, tag: &str, value: &str) -> Result<()>

Add tag to a song

fn untag<T: ToSongId>(&mut self, song: T, tag: &str) -> Result<()>

Delete tag from a song

fn ping(&mut self) -> Result<()>

Just pings MPD server, does nothing

fn close(&mut self) -> Result<()>

Close MPD connection

fn kill(&mut self) -> Result<()>

Kill MPD server

fn login(&mut self, password: &str) -> Result<()>

Login to MPD server with given password

fn playlists(&mut self) -> Result<Vec<Playlist>>

List all playlists

fn playlist<N: ToPlaylistName>(&mut self, name: N) -> Result<Vec<Song>>

List all songs in a playlist

fn load<T: ToQueueRange, N: ToPlaylistName>(&mut self, name: N, range: T) -> Result<()>

Load playlist into queue

You can give either full range (..) to load all songs in a playlist, or some partial range to load only part of playlist.

fn save<N: ToPlaylistName>(&mut self, name: N) -> Result<()>

Save current queue into playlist

If playlist with given name doesn't exist, create new one.

fn pl_rename<N: ToPlaylistName>(&mut self, name: N, newname: &str) -> Result<()>

Rename playlist

fn pl_clear<N: ToPlaylistName>(&mut self, name: N) -> Result<()>

Clear playlist

fn pl_remove<N: ToPlaylistName>(&mut self, name: N) -> Result<()>

Delete playlist

fn pl_push<N: ToPlaylistName, P: AsRef<str>>(&mut self, name: N, path: P) -> Result<()>

Add new songs to a playlist

fn pl_delete<N: ToPlaylistName>(&mut self, name: N, pos: u32) -> Result<()>

Delete a song at a given position in a playlist

fn pl_shift<N: ToPlaylistName>(&mut self, name: N, from: u32, to: u32) -> Result<()>

Move song in a playlist from one position into another

fn rescan(&mut self) -> Result<u32>

Run database rescan, i.e. remove non-existing files from DB as well as add new files to DB

fn update(&mut self) -> Result<u32>

Run database update, i.e. remove non-existing files from DB

fn query<'a>(&'a mut self) -> Query<'a, S>

Initiate query to songs database

fn outputs(&mut self) -> Result<Vec<Output>>

List all outputs

fn output<T: ToOutputId>(&mut self, id: T, state: bool) -> Result<()>

Set given output enabled state

fn out_disable<T: ToOutputId>(&mut self, id: T) -> Result<()>

Disable given output

fn out_enable<T: ToOutputId>(&mut self, id: T) -> Result<()>

Enable given output

fn out_toggle<T: ToOutputId>(&mut self, id: T) -> Result<()>

Toggle given output

fn music_directory(&mut self) -> Result<String>

Get current music directory

fn commands(&mut self) -> Result<Vec<String>>

List all available commands

fn notcommands(&mut self) -> Result<Vec<String>>

List all forbidden commands

fn urlhandlers(&mut self) -> Result<Vec<String>>

List all available URL handlers

fn tagtypes(&mut self) -> Result<Vec<String>>

List all supported tag types

fn decoders(&mut self) -> Result<Vec<Plugin>>

List all available decoder plugins

fn channels(&mut self) -> Result<Vec<Channel>>

List all channels available for current connection

fn readmessages(&mut self) -> Result<Vec<Message>>

Read queued messages from subscribed channels

fn sendmessage(&mut self, channel: Channel, message: &str) -> Result<()>

Send a message to a channel

fn subscribe(&mut self, channel: Channel) -> Result<()>

Subscribe to a channel

fn unsubscribe(&mut self, channel: Channel) -> Result<()>

Unsubscribe to a channel

fn mounts(&mut self) -> Result<Vec<Mount>>

List all (virtual) mounts

These mounts exist inside MPD process only, thus they can work without root permissions.

fn neighbors(&mut self) -> Result<Vec<Neighbor>>

List all network neighbors, which can be potentially mounted

fn mount(&mut self, path: &str, uri: &str) -> Result<()>

Mount given neighbor to a mount point

The mount exists inside MPD process only, thus it can work without root permissions.

fn unmount(&mut self, path: &str) -> Result<()>

Unmount given active (virtual) mount

The mount exists inside MPD process only, thus it can work without root permissions.

fn sticker(&mut self, typ: &str, uri: &str, name: &str) -> Result<String>

Show sticker value for a given object, identified by type and uri

fn set_sticker(&mut self, typ: &str, uri: &str, name: &str, value: &str) -> Result<()>

Set sticker value for a given object, identified by type and uri

fn delete_sticker(&mut self, typ: &str, uri: &str, name: &str) -> Result<()>

Delete sticker from a given object, identified by type and uri

fn clear_stickers(&mut self, typ: &str, uri: &str) -> Result<()>

Remove all stickers from a given object, identified by type and uri

fn stickers(&mut self, typ: &str, uri: &str) -> Result<Vec<String>>

List all stickers from a given object, identified by type and uri

fn find_sticker(&mut self, typ: &str, uri: &str, name: &str) -> Result<Vec<(String, String)>>

List all (file, sticker) pairs for sticker name and objects of given type from given directory (identified by uri)

fn find_sticker_eq(&mut self, typ: &str, uri: &str, name: &str, value: &str) -> Result<Vec<String>>

List all files of a given type under given directory (identified by uri) with a tag set to given value

Trait Implementations

impl<S: Read + Write> Idle for Client<S>
[src]

type Stream = S

Stream type of a client

fn idle<'a>(&'a mut self, subsystems: &[Subsystem]) -> Result<IdleGuard<'a, S>, Error>

Start listening for events from a set of subsystems Read more

fn wait(&mut self, subsystems: &[Subsystem]) -> Result<Vec<Subsystem>, Error>

Wait for events from a set of subsystems and return list of affected subsystems Read more

impl<S: Debug> Debug for Client<S> where S: Read + Write
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Default for Client<TcpStream>
[src]

fn default() -> Client<TcpStream>

Returns the "default value" for a type. Read more