Skip to main content

PlaybackCommand

Enum PlaybackCommand 

Source
pub enum PlaybackCommand {
Show 23 variants Play(Option<usize>), Pause, Stop, TogglePlaying, GetPlaybackState, SetQueue(Vec<PathBuf>), AppendToQueue(Vec<PathBuf>), AppendPlaylist(String), SetPlaylist(String), GetCurrentTrack, Next, Previous, SetLoopState(LoopState), GetLoopState, SetRate(f64), GetRate, SetShuffleState(ShuffleState), GetShuffleState, SetPlayerPosition(Duration), Seek(SignedDuration), GetPlayerPosition, SetPlayerVolume(PlayerVolume), GetPlayerVolume,
}
Expand description

Subcommand of Command for managing audio playback in the daemon.

The expected response may be different depending on the command sent. If it isn’t specified in the variant documentation, assume Response::Ok is the expected response.

Variants§

§

Play(Option<usize>)

Play the current track or play a track at a specific index in the queue.

§

Pause

Pause the player.

§

Stop

Stop the player.

§

TogglePlaying

Toggle between play/pause.

§

GetPlaybackState

Get the PlaybackState of the player.

The daemon will respond with PlaybackResponse::PlaybackState if successful.

§

SetQueue(Vec<PathBuf>)

Set a new queue for the player.

If any of the provided tracks are not registered by chilen (added after last library reload), the daemon will return LibraryError::NoSuchTrack.

§

AppendToQueue(Vec<PathBuf>)

Append tracks to the queue.

If any of the provided tracks are not registered by chilen (added after last library reload), the daemon will return LibraryError::NoSuchTrack.

§

AppendPlaylist(String)

Load a playlist and append its tracks to the queue.

If there’s no playlist with the provided name present in the music library, LibraryError::NoSuchPlaylist will be returned, and no changes to the queue will be made.

§

SetPlaylist(String)

Load a playlist and put its tracks in the queue.

If there’s no playlist with the provided name present in the music library, LibraryError::NoSuchPlaylist will be returned, and no changes to the queue will be made.

§

GetCurrentTrack

Get the current track.

The daemon will respond to this with PlaybackResponse::Track if successful.

§

Next

Skip to the next track.

§

Previous

Skip to the previous track.

§

SetLoopState(LoopState)

Set the loop state of the player.

§

GetLoopState

Get the loop state of the player.

The daemon will respond to this with PlaybackResponse::LoopState if successful.

§

SetRate(f64)

Set the playback rate of the player.

This command will fail if the daemon is configured to not allow playback rate modification or if the specified rate value was out of the acceptable range.

If the daemon is configured not to allow playback rate modification, PlaybackError::FixedRate will be returned.

If the provided rate value is out of the allowed range, PlaybackError::RateOutOfRange will be returned.

§

GetRate

Get the playback rate of the player.

The daemon will respond to this with PlaybackResponse::PlaybackRate if successful.

§

SetShuffleState(ShuffleState)

Set the shuffle state of the player.

The daemon will always respond to this command with PlaybackError::ShuffleNotSupported if it was built without shuffle support.

§

GetShuffleState

Get the shuffle state of the player.

If the daemon was built without shuffle support, it will always respond to this command with ShuffleState::Off. Otherwise, it will return PlaybackResponse::ShuffleState.

§

SetPlayerPosition(Duration)

Set the position of the player.

§

Seek(SignedDuration)

Change the player position by a time delta.

§

GetPlayerPosition

Get the position of the player.

The daemon will respond to this with PlaybackResponse::PlayerPosition if successful.

§

SetPlayerVolume(PlayerVolume)

Set the volume of the player.

§

GetPlayerVolume

Get the volume of the player.

The daemon will respond to this with PlaybackResponse::PlayerVolume if successful.

Trait Implementations§

Source§

impl Clone for PlaybackCommand

Source§

fn clone(&self) -> PlaybackCommand

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PlaybackCommand

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for PlaybackCommand

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for PlaybackCommand

Source§

fn eq(&self, other: &PlaybackCommand) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for PlaybackCommand

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for PlaybackCommand

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T> TryClone for T
where T: Clone,

§

fn try_clone(&self) -> Result<T, Error>

Clones self, possibly returning an error.
Source§

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

Source§

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>,

Source§

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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,