core: add docstrings for variants of MpvCommand
Some checks are pending
Build and test / build (push) Waiting to run
Build and test / check (push) Waiting to run
Build and test / test (push) Waiting to run
Build and test / docs (push) Waiting to run

This commit is contained in:
Oystein Kristoffer Tveit 2024-12-14 12:55:45 +01:00
parent 3cf5c2c515
commit fc7ff1c9bf
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146

View File

@ -27,38 +27,76 @@ use crate::{
/// the upstream list of commands. /// the upstream list of commands.
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
pub enum MpvCommand { pub enum MpvCommand {
/// Load the given file or URL and play it.
LoadFile { LoadFile {
file: String, file: String,
option: PlaylistAddOptions, option: PlaylistAddOptions,
}, },
/// Load the given playlist file or URL.
LoadList { LoadList {
file: String, file: String,
option: PlaylistAddOptions, option: PlaylistAddOptions,
}, },
/// Clear the playlist, except for the currently playing file.
PlaylistClear, PlaylistClear,
///Move the playlist entry at `from`, so that it takes the place of the entry `to`.
/// (Paradoxically, the moved playlist entry will not have the index value `to` after moving
/// if `from` was lower than `to`, because `to` refers to the target entry, not the index
/// the entry will have after moving.)
PlaylistMove { PlaylistMove {
from: usize, from: usize,
to: usize, to: usize,
}, },
/// Observe a property. This will start triggering [`Event::PropertyChange`] events
/// in the event stream whenever the specific property changes.
/// You can use [`Mpv::get_event_stream`] to get the stream.
Observe { Observe {
id: u64, id: u64,
property: String, property: String,
}, },
/// Skip to the next entry in the playlist.
PlaylistNext, PlaylistNext,
/// Skip to the previous entry in the playlist.
PlaylistPrev, PlaylistPrev,
/// Remove an entry from the playlist by its position in the playlist.
PlaylistRemove(usize), PlaylistRemove(usize),
/// Shuffle the playlist
PlaylistShuffle, PlaylistShuffle,
/// Exit the player
Quit, Quit,
/// Send a message to all clients, and pass it the following list of arguments.
/// What this message means, how many arguments it takes, and what the arguments
/// mean is fully up to the receiver and the sender.
ScriptMessage(Vec<String>), ScriptMessage(Vec<String>),
/// Same as [`MpvCommand::ScriptMessage`], but send the message to a specific target.
ScriptMessageTo { ScriptMessageTo {
target: String, target: String,
args: Vec<String>, args: Vec<String>,
}, },
/// Change the playback position.
Seek { Seek {
seconds: f64, seconds: f64,
option: SeekOptions, option: SeekOptions,
}, },
/// Stop the current playback, and clear the playlist.
/// This esentially resets the entire player state without exiting mpv.
Stop, Stop,
/// Unobserve all properties registered with the given id.
/// See [`MpvCommand::Observe`] for more context.
Unobserve(u64), Unobserve(u64),
} }