MocInterface

Trait MocInterface 

Source
pub trait MocInterface {
Show 20 methods // Required methods fn new(moc_path: String) -> Self; fn info(&self) -> MocInfo; fn clear_playlist(&mut self) -> bool; fn play_playlist(&mut self) -> bool; fn immediate_play(&mut self, source: MocSource) -> bool; fn stop_server(&mut self) -> bool; fn start_server(&mut self) -> bool; fn next_song(&mut self) -> bool; fn previous_song(&mut self) -> bool; fn stop_playback(&mut self) -> bool; fn pause_playback(&mut self) -> bool; fn resume_playback(&mut self) -> bool; fn set_volume(&mut self, vol: usize) -> bool; fn increase_volume_by(&mut self, step: usize) -> bool; fn decrease_volume_by(&mut self, step: usize) -> bool; fn append_music(&mut self, path: &Path) -> bool; fn seek(&mut self, step: isize) -> bool; fn jump_to(&mut self, time: Duration) -> bool; fn enable_control(&mut self, control: MocControl) -> bool; fn disable_control(&mut self, control: MocControl) -> bool;
}
Expand description

The trait for most of this crate’s functionality, it exposes all the functions to interact with MoC.

Required Methods§

Source

fn new(moc_path: String) -> Self

Source

fn info(&self) -> MocInfo

Get all the info about what MoC is currently doing, refer to MocInfo’s implementations for the methods to get each field

Source

fn clear_playlist(&mut self) -> bool

Clear MoC’s current playlist.

Source

fn play_playlist(&mut self) -> bool

Play MoC’s current playlist starting from the first item.

Source

fn immediate_play(&mut self, source: MocSource) -> bool

Immediately play the source, it can be a file or stream url but it has to be constructed using MocSource.

Source

fn stop_server(&mut self) -> bool

Literally just game end MoC.

Source

fn start_server(&mut self) -> bool

Launch the MoC server

Source

fn next_song(&mut self) -> bool

Skip to the next song.

Source

fn previous_song(&mut self) -> bool

Go back to the previous song.

Source

fn stop_playback(&mut self) -> bool

Stop all playback

Source

fn pause_playback(&mut self) -> bool

Pause playback.

Source

fn resume_playback(&mut self) -> bool

Resume playback.

Source

fn set_volume(&mut self, vol: usize) -> bool

Set the volume for MoC.

Source

fn increase_volume_by(&mut self, step: usize) -> bool

Instead of setting the volume, increase the volume by the step.

Source

fn decrease_volume_by(&mut self, step: usize) -> bool

Same as above but for decreasing.

Source

fn append_music(&mut self, path: &Path) -> bool

Append a music file to the playlist, doesn’t support streams…

You could however clear the current playlist, write the stream url to an m3u file and load that file.

Source

fn seek(&mut self, step: isize) -> bool

Seek forwards and backwards on the currently playing track, this doesn’t jump to that duration, it seeks, therefore if you give the step the value of -10 it seeks ten seconds back, for the value of 10 it seeks ten seconds forwards

Source

fn jump_to(&mut self, time: Duration) -> bool

Jump to a location in the current track.

Source

fn enable_control(&mut self, control: MocControl) -> bool

Enable one of the flags, refer to MocControl

Source

fn disable_control(&mut self, control: MocControl) -> bool

Disable one of the flags, refer to MocControl

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§