Playerctl.PlayerManager

g GObject.Object GObject.Object Playerctl.PlayerManager Playerctl.PlayerManager GObject.Object->Playerctl.PlayerManager

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

manage_player (player)

move_player_to_top (player)

set_sort_func (sort_func, *sort_data)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

player-names

int

r

A list of player names that are currently available to control.

players

int

r

A list of player objects managed by this manager

Signals

Inherited:

GObject.Object (1)

Name

Short Description

name-appeared

Emitted when a new name has appeared and is available to connect to.

name-vanished

Emitted when the name has vanished and is no longer available to be controlled by playerctl.

player-appeared

Emitted when a new player will be managed by this manager through a call to Playerctl.PlayerManager.manage_player().

player-vanished

Emitted when a player has disconnected and will no longer be managed by this manager.

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class Playerctl.PlayerManager(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Playerctl.PlayerManagerClass

classmethod new()
Raises:

GLib.Error

Returns:

A new Playerctl.PlayerManager.

Return type:

Playerctl.PlayerManager

Create a new player manager that contains a list of player names available in the Playerctl.PlayerManager :player-names property. You can create new players from the names with the Playerctl.Player.new_from_name() function and then start managing them with the Playerctl.PlayerManager.manage_player() function.

manage_player(player)
Parameters:

player (Playerctl.Player) – A Playerctl.Player to manage

Add the given player to the list of managed players. Takes a reference to the player (so you can unref it after you call this function). The player will automatically be unreffed and removed from the list of Playerctl.PlayerManager :players when it disconnects and the Playerctl.PlayerManager ::player-vanished signal will be emitted on the manager.

move_player_to_top(player)
Parameters:

player (Playerctl.Player) – A Playerctl.Player in the list of Playerctl.PlayerManager :players

Moves the player to the top of the list of Playerctl.PlayerManager :players. If this manager has a sort function set with Playerctl.PlayerManager.set_sort_func(), the list of players will be sorted afterward, but will be on top of equal players in the sorted order.

set_sort_func(sort_func, *sort_data)
Parameters:

Keeps the Playerctl.PlayerManager :players list of this manager in sorted order which is useful for using this list as a priority queue.

Signal Details

Playerctl.PlayerManager.signals.name_appeared(player_manager, name)
Signal Name:

name-appeared

Flags:

RUN_LAST

Parameters:

Emitted when a new name has appeared and is available to connect to. Use Playerctl.Player.new_from_name() to connect to the player and Playerctl.PlayerManager.manage_player() to add it to the managed list of players.

Playerctl.PlayerManager.signals.name_vanished(player_manager, name)
Signal Name:

name-vanished

Flags:

RUN_FIRST

Parameters:

Emitted when the name has vanished and is no longer available to be controlled by playerctl. If the player is managed, it will automatically be removed from the list of players and the Playerctl.PlayerManager ::player-vanished signal will be emitted automatically.

Playerctl.PlayerManager.signals.player_appeared(player_manager, player)
Signal Name:

player-appeared

Flags:

RUN_FIRST

Parameters:

Emitted when a new player will be managed by this manager through a call to Playerctl.PlayerManager.manage_player().

Playerctl.PlayerManager.signals.player_vanished(player_manager, player)
Signal Name:

player-vanished

Flags:

RUN_FIRST

Parameters:

Emitted when a player has disconnected and will no longer be managed by this manager. The player is removed from the list of players automatically.

Property Details

Playerctl.PlayerManager.props.player_names
Name:

player-names

Type:

int

Default Value:

None

Flags:

READABLE

A list of fully qualified player names that are currently available to control.

Playerctl.PlayerManager.props.players
Name:

players

Type:

int

Default Value:

None

Flags:

READABLE

A list of players that are currently connected and managed by this class.