[][src]Struct mpvipc::Mpv

pub struct Mpv { /* fields omitted */ }

Methods

impl Mpv[src]

pub fn connect(socket: &str) -> Result<Mpv, Error>[src]

pub fn disconnect(&self)[src]

pub fn get_stream_ref(&self) -> &UnixStream[src]

pub fn get_metadata(&self) -> Result<HashMap<String, MpvDataType>, Error>[src]

pub fn get_playlist(&self) -> Result<Playlist, Error>[src]

pub fn get_property<T: GetPropertyTypeHandler>(
    &self,
    property: &str
) -> Result<T, Error>
[src]

#Description

Retrieves the property value from mpv.

##Supported types

  • String
  • bool
  • HashMap<String, String> (e.g. for the 'metadata' property)
  • Vec (for the 'playlist' property)
  • usize
  • f64

##Input arguments

  • property defines the mpv property that should be retrieved

#Example

let mpv = Mpv::connect("/tmp/mpvsocket")?;
let paused: bool = mpv.get_property("pause")?;
let title: String = mpv.get_property("media-title")?;

pub fn get_property_string(&self, property: &str) -> Result<String, Error>[src]

#Description

Retrieves the property value from mpv. The result is always of type String, regardless of the type of the value of the mpv property

##Input arguments

  • property defines the mpv property that should be retrieved

#Example

let mpv = Mpv::connect("/tmp/mpvsocket")?;
let title = mpv.get_property_string("media-title")?;

pub fn kill(&self) -> Result<(), Error>[src]

pub fn event_listen(&mut self) -> Result<Event, Error>[src]

#Description

Waits until an mpv event occurs and returns the Event.

#Example

This example is not tested
let mut mpv = Mpv::connect("/tmp/mpvsocket")?;
loop {
    let event = mpv.event_listen()?;
    println!("{:?}", event);
}

pub fn event_listen_raw(&mut self) -> String[src]

pub fn next(&self) -> Result<(), Error>[src]

pub fn observe_property(&self, id: &isize, property: &str) -> Result<(), Error>[src]

pub fn pause(&self) -> Result<(), Error>[src]

pub fn prev(&self) -> Result<(), Error>[src]

pub fn restart(&self) -> Result<(), Error>[src]

pub fn run_command(&self, command: &str, args: &[&str]) -> Result<(), Error>[src]

#Description

Runs mpv commands. The arguments are passed as a String-Vector reference:

##Input arguments

  • command defines the mpv command that should be executed
  • args a slice of &str's which define the arguments

#Example

let mpv = Mpv::connect("/tmp/mpvsocket")?;

//Run command 'playlist-shuffle' which takes no arguments
mpv.run_command("playlist-shuffle", &[])?;

//Run command 'seek' which in this case takes two arguments
mpv.run_command("seek", &["0", "absolute"])?;

pub fn playlist_add(
    &self,
    file: &str,
    file_type: PlaylistAddTypeOptions,
    option: PlaylistAddOptions
) -> Result<(), Error>
[src]

pub fn playlist_clear(&self) -> Result<(), Error>[src]

pub fn playlist_move_id(&self, from: usize, to: usize) -> Result<(), Error>[src]

pub fn playlist_play_id(&self, id: usize) -> Result<(), Error>[src]

pub fn playlist_play_next(&self, id: usize) -> Result<(), Error>[src]

pub fn playlist_remove_id(&self, id: usize) -> Result<(), Error>[src]

pub fn playlist_shuffle(&self) -> Result<(), Error>[src]

pub fn seek(&self, seconds: f64, option: SeekOptions) -> Result<(), Error>[src]

pub fn set_loop_file(&self, option: Switch) -> Result<(), Error>[src]

pub fn set_loop_playlist(&self, option: Switch) -> Result<(), Error>[src]

pub fn set_mute(&self, option: Switch) -> Result<(), Error>[src]

pub fn set_property<T: SetPropertyTypeHandler<T>>(
    &self,
    property: &str,
    value: T
) -> Result<(), Error>
[src]

#Description

Sets the mpv property to .

##Supported types

  • String
  • bool
  • f64
  • usize

##Input arguments

  • property defines the mpv property that should be retrieved
  • value defines the value of the given mpv property

#Example

let mpv = Mpv::connect("/tmp/mpvsocket")?;
mpv.set_property("pause", true)?;

pub fn set_speed(
    &self,
    input_speed: f64,
    option: NumberChangeOptions
) -> Result<(), Error>
[src]

pub fn set_volume(
    &self,
    input_volume: f64,
    option: NumberChangeOptions
) -> Result<(), Error>
[src]

pub fn stop(&self) -> Result<(), Error>[src]

pub fn toggle(&self) -> Result<(), Error>[src]

Trait Implementations

impl Drop for Mpv[src]

impl Clone for Mpv[src]

impl Debug for Mpv[src]

Auto Trait Implementations

impl Send for Mpv

impl Sync for Mpv

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]