Skip to main content

LibraryCommand

Enum LibraryCommand 

Source
pub enum LibraryCommand {
    NewPlaylist {
        name: String,
        tracks: Option<Vec<PathBuf>>,
    },
    PlaylistFromM3U8 {
        name: String,
        m3u8_file: PathBuf,
    },
    DeletePlaylists {
        names: Vec<String>,
    },
    AddTracksToPlaylist {
        name: String,
        tracks: Vec<PathBuf>,
    },
    RemoveTracksFromPlaylist {
        name: String,
        ids: Vec<usize>,
    },
    GetLibrary,
    Rebuild,
    Reload,
}
Expand description

Subcommand of Command for managing the music library.

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§

§

NewPlaylist

Create a new playlist, optionally with some tracks in it.

Fields

§name: String

The name for the new playlist. Must not already exist in the music library.

If a playlist with the specified name already exists, LibraryError::PlaylistExists will be returned, and no changes to the music library will be made.

§tracks: Option<Vec<PathBuf>>

Optional list of paths to tracks to be added to the playlist.

This command will fail if any of the tracks are not registered in the music library, or if the list contains duplicates.

§

PlaylistFromM3U8

Import a playlist from an M3U8 file.

This is currently unimplemented and will cause the daemon to panic.

Fields

§name: String

The name for the imported playlist. Must not already exist in the music library.

If a playlist with the specified name already exists, LibraryError::PlaylistExists will be returned, and no changes to the music library will be made.

§m3u8_file: PathBuf

The path to the M3U8 file to import.

§

DeletePlaylists

Delete playlists from the music library.

Fields

§names: Vec<String>

List of the playlists to delete.

If any of the provided playlists don’t exist in the music library, LibraryError::NoSuchPlaylist will be returned, and no changes to the music library will be made.

§

AddTracksToPlaylist

Add tracks to an already existing playlist.

Fields

§name: String

The name of the playlist to add tracks to.

If a playlist with the specified name doesn’t exist in the music library, LibraryError::NoSuchPlaylist will be returned, and no changes to the music library will be made.

§tracks: Vec<PathBuf>

List of paths to tracks to add to the playlist.

Note: the daemon will return an error if any of the tracks are not registered in the music library or if the list contains duplicates.

§

RemoveTracksFromPlaylist

Remove tracks from a playlist.

Fields

§name: String

The name of the playlist to remove tracks from.

If a playlist with the specified name doesn’t exist in the music library, LibraryError::NoSuchPlaylist will be returned, and no changes to the music library will be made.

§ids: Vec<usize>

The list of track indices in the playlist to remove.

Eg. to remove the first track you would pass [0], to remove the first three [0, 1, 2], etc.

If one or more of the indices is out of range, LibraryError::IndexOutOfBounds will be returned, and no changes to the music library will be made.

§

GetLibrary

Get the contents of the music library.

The daemon will respond to this with Response::Library if successful.

§

Rebuild

Reload the library and rebuild the cache ignoring already cached covers.

Will take more time than just reloading the cache.

§

Reload

Reload the library using cached data if possible.

This can be used to discover newly added tracks.

Trait Implementations§

Source§

impl Clone for LibraryCommand

Source§

fn clone(&self) -> LibraryCommand

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 LibraryCommand

Source§

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

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

impl<'de> Deserialize<'de> for LibraryCommand

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 Hash for LibraryCommand

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for LibraryCommand

Source§

fn eq(&self, other: &LibraryCommand) -> 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 LibraryCommand

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 Eq for LibraryCommand

Source§

impl StructuralPartialEq for LibraryCommand

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