pub struct PlayerFinder { /* private fields */ }Expand description
Used to find Players running on a D-Bus connection.
All find results are sorted in alphabetical order.
Implementations§
Source§impl PlayerFinder
impl PlayerFinder
Sourcepub fn new() -> Result<Self, DBusError>
pub fn new() -> Result<Self, DBusError>
Creates a new PlayerFinder with a new default D-Bus connection.
Use for_connection if you want to provide the D-Bus connection yourself.
Sourcepub fn for_connection(connection: Connection) -> Self
pub fn for_connection(connection: Connection) -> Self
Create a new PlayerFinder with the given connection.
Use new if you want a new default connection rather than manually managing the D-Bus
connection.
Sourcepub fn player_timeout_ms(&self) -> i32
pub fn player_timeout_ms(&self) -> i32
Get the current timeout value that all Players created through this finder will inherit
Can be set with set_player_timeout_ms
Sourcepub fn set_player_timeout_ms(&mut self, timeout_ms: i32)
pub fn set_player_timeout_ms(&mut self, timeout_ms: i32)
Set the timeout value that all Players created through this finder will inherit
Sourcepub fn find_all(&self) -> Result<Vec<Player>, FindingError>
pub fn find_all(&self) -> Result<Vec<Player>, FindingError>
Find all available Players in the connection.
Will return an empty Vec and not NoPlayerFound if there are no players.
Sourcepub fn find_first(&self) -> Result<Player, FindingError>
pub fn find_first(&self) -> Result<Player, FindingError>
Return the first found Player regardless of state.
Sourcepub fn find_active(&self) -> Result<Player, FindingError>
pub fn find_active(&self) -> Result<Player, FindingError>
Try to find the “active” Player in the connection.
This method will try to determine which player a user is most likely to use. First it will look for a player with
the playback status Playing, then for a Paused, then one with
track metadata, after that it will just return the first it finds. NoPlayerFound is returned
only if there is no player on the DBus.
Sourcepub fn find_by_name(&self, name: &str) -> Result<Player, FindingError>
pub fn find_by_name(&self, name: &str) -> Result<Player, FindingError>
Find a Player by it’s MPRIS Identity. Returns NoPlayerFound if no direct match found.
Sourcepub fn iter_players(&self) -> Result<PlayerIter, DBusError>
pub fn iter_players(&self) -> Result<PlayerIter, DBusError>
Returns a PlayerIter iterator, or an DBusError if there was a problem with the D-Bus
For more details see PlayerIter documentation