Struct mlounge_client::MLoungeClient
source · 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: PlaylistThe play queue (can be a playlist)
song: SongThe currently playing song
state: PlayerStateThe state of the player
repeat: RepeatModeShould one song, all songs, or no songs be repeated?
Implementations§
source§impl MLoungeClient
impl MLoungeClient
sourcepub fn new() -> MLoungeClient
pub fn new() -> MLoungeClient
Create a new MLoungeClient
sourcepub fn load_list(
&mut self,
list: &Playlist,
first_song: &Song
) -> PlayerResult<()>
pub fn load_list( &mut self, list: &Playlist, first_song: &Song ) -> PlayerResult<()>
Load a playlist into the player and start playing it
sourcepub fn cycle_repeat(&mut self) -> PlayerResult<()>
pub fn cycle_repeat(&mut self) -> PlayerResult<()>
Set the repeat mode
sourcepub fn restart(&mut self) -> PlayerResult<()>
pub fn restart(&mut self) -> PlayerResult<()>
Restart the current song
sourcepub fn next_song(&mut self) -> PlayerResult<()>
pub fn next_song(&mut self) -> PlayerResult<()>
Skip to the mext song
sourcepub fn prev_song(&mut self) -> PlayerResult<()>
pub fn prev_song(&mut self) -> PlayerResult<()>
Skip to the previous song
sourcepub fn play_pause(&mut self) -> PlayerResult<()>
pub fn play_pause(&mut self) -> PlayerResult<()>
Toggle song playback
sourcepub fn stop(&mut self) -> PlayerResult<()>
pub fn stop(&mut self) -> PlayerResult<()>
Stop the player and clear the play queue
sourcepub fn shuffle_queue(&mut self) -> PlayerResult<()>
pub fn shuffle_queue(&mut self) -> PlayerResult<()>
Shuffle the play queue
sourcepub fn cur_time_secs(&self) -> u64
pub fn cur_time_secs(&self) -> u64
Get the current time of the song in seconds
sourcepub fn set_pos(&mut self, song: &Song) -> PlayerResult<()>
pub fn set_pos(&mut self, song: &Song) -> PlayerResult<()>
Skip to another song in the play queue
sourcepub fn song_changed(&mut self) -> bool
pub fn song_changed(&mut self) -> bool
Check if the player is still playing a song or if it has been changed
sourcepub fn sync(&mut self, reverse: bool) -> PlayerResult<()>
pub fn sync(&mut self, reverse: bool) -> PlayerResult<()>
Sync player status and play queue
sourcepub fn quick_sync(&mut self)
pub fn quick_sync(&mut self)
Sync just the player status
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for MLoungeClient
impl Send for MLoungeClient
impl Sync for MLoungeClient
impl Unpin for MLoungeClient
impl UnwindSafe for MLoungeClient
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more