Trait mpris_server::LocalPlaylistsInterface

source ·
pub trait LocalPlaylistsInterface: LocalPlayerInterface {
    // Required methods
    async fn activate_playlist(&self, playlist_id: PlaylistId) -> Result<()>;
    async fn get_playlists(
        &self,
        index: u32,
        max_count: u32,
        order: PlaylistOrdering,
        reverse_order: bool,
    ) -> Result<Vec<Playlist>>;
    async fn playlist_count(&self) -> Result<u32>;
    async fn orderings(&self) -> Result<Vec<PlaylistOrdering>>;
    async fn active_playlist(&self) -> Result<Option<Playlist>>;
}
Expand description

Local version of PlaylistsInterface to be used with LocalServer.

Used to implement org.mpris.MediaPlayer2.Playlists interface, which provides access to the media player’s playlists.

Since D-Bus does not provide an easy way to check for what interfaces are exported on an object, clients should attempt to get one of the properties on this interface to see if it is implemented.

Required Methods§

source

async fn activate_playlist(&self, playlist_id: PlaylistId) -> Result<()>

Starts playing the given playlist.

§Parameters
  • playlist_id - The id of the playlist to activate.

Note that this must be implemented. If the media player does not allow clients to change the playlist, it should not implement this interface at all.

It is up to the media player whether this completely replaces the current tracklist, or whether it is merely inserted into the tracklist and the first track starts. For example, if the media player is operating in a “jukebox” mode, it may just append the playlist to the list of upcoming tracks, and skip to the first track in the playlist.

source

async fn get_playlists( &self, index: u32, max_count: u32, order: PlaylistOrdering, reverse_order: bool, ) -> Result<Vec<Playlist>>

Gets a set of playlists.

§Parameters
  • index - The index of the first playlist to be fetched (according to the ordering).
  • max_count - The maximum number of playlists to fetch.
  • order - The ordering that should be used.
  • reverse_order - Whether the order should be reversed.
§Returns
  • playlists - A list of (at most max_count) playlists.
source

async fn playlist_count(&self) -> Result<u32>

The number of playlists available.

When this property changes, the org.freedesktop.DBus.Properties.PropertiesChanged signal via playlists_properties_changed must be emitted with the new value.

source

async fn orderings(&self) -> Result<Vec<PlaylistOrdering>>

The available orderings. At least one must be offered.

When this property changes, the org.freedesktop.DBus.Properties.PropertiesChanged signal via playlists_properties_changed must be emitted with the new value.

Rationale

Media players may not have access to all the data required for some orderings. For example, creation times are not available on UNIX filesystems (don’t let the ctime fool you!). On the other hand, clients should have some way to get the “most recent” playlists.

source

async fn active_playlist(&self) -> Result<Option<Playlist>>

The currently-active playlist.

When this property changes, the org.freedesktop.DBus.Properties.PropertiesChanged signal via playlists_properties_changed must be emitted with the new value.

If there is no currently-active playlist, this should return None.

Note that this may not have a value even after ActivatePlaylist is called with a valid playlist id as ActivatePlaylist implementations have the option of simply inserting the contents of the playlist into the current tracklist.

Object Safety§

This trait is not object safe.

Implementors§