Struct mpris::PlayerFinder
source · pub struct PlayerFinder { /* private fields */ }
Expand description
Used to find Player
s 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 Player
s 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 Player
s 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 Player
s 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