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: StringThe 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: StringThe 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.
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: StringThe 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.
RemoveTracksFromPlaylist
Remove tracks from a playlist.
Fields
name: StringThe 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
impl Clone for LibraryCommand
Source§fn clone(&self) -> LibraryCommand
fn clone(&self) -> LibraryCommand
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LibraryCommand
impl Debug for LibraryCommand
Source§impl<'de> Deserialize<'de> for LibraryCommand
impl<'de> Deserialize<'de> for LibraryCommand
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Hash for LibraryCommand
impl Hash for LibraryCommand
Source§impl PartialEq for LibraryCommand
impl PartialEq for LibraryCommand
Source§fn eq(&self, other: &LibraryCommand) -> bool
fn eq(&self, other: &LibraryCommand) -> bool
self and other values to be equal, and is used by ==.