pub struct MLoungeClient {
    pub queue: Playlist,
    pub song: Song,
    pub state: PlayerState,
    pub repeat: RepeatMode,
    /* private fields */
}
Expand description

Client object for the user interface, used to control the background process

Fields§

§queue: Playlist

The play queue (can be a playlist)

§song: Song

The currently playing song

§state: PlayerState

The state of the player

§repeat: RepeatMode

Should one song, all songs, or no songs be repeated?

Implementations§

source§

impl MLoungeClient

source

pub fn new() -> MLoungeClient

Create a new MLoungeClient

source

pub fn load_list( &mut self, list: &Playlist, first_song: &Song ) -> PlayerResult<()>

Load a playlist into the player and start playing it

source

pub fn is_empty(&self) -> bool

Is the player empty?

source

pub fn cycle_repeat(&mut self) -> PlayerResult<()>

Set the repeat mode

source

pub fn restart(&mut self) -> PlayerResult<()>

Restart the current song

source

pub fn next_song(&mut self) -> PlayerResult<()>

Skip to the mext song

source

pub fn prev_song(&mut self) -> PlayerResult<()>

Skip to the previous song

source

pub fn play_pause(&mut self) -> PlayerResult<()>

Toggle song playback

source

pub fn stop(&mut self) -> PlayerResult<()>

Stop the player and clear the play queue

source

pub fn shuffle_queue(&mut self) -> PlayerResult<()>

Shuffle the play queue

source

pub fn cur_time(&self) -> String

Get the current time of the song

source

pub fn cur_time_secs(&self) -> u64

Get the current time of the song in seconds

source

pub fn set_pos(&mut self, song: &Song) -> PlayerResult<()>

Skip to another song in the play queue

source

pub fn song_changed(&mut self) -> bool

Check if the player is still playing a song or if it has been changed

source

pub fn sync(&mut self, reverse: bool) -> PlayerResult<()>

Sync player status and play queue

source

pub fn quick_sync(&mut self)

Sync just the player status

source

pub fn seek(&self, time: u64)

Seek to a specific time in the current song

source

pub fn set_song(&mut self, song: &Song)

Set the current song to play

Trait Implementations§

source§

impl Default for MLoungeClient

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V