MPRIS (media)#

class ignis.services.mpris.MprisService(*args: Any, **kwargs: Any)#

A service for controlling media players using the MPRIS interface.

Example usage:

from ignis.services.mpris import MprisService

mpris = MprisService.get_default()

mpris.connect("player_added", lambda x, player: print(player.desktop_entry, player.title))
signal player_added#

Emitted when a player has been added.

Parameters:

player (MprisPlayer) -- The instance of the player.

gproperty players: list[MprisPlayer]#
  • read-only

A list of currently active players.

class ignis.services.mpris.MprisPlayer(mpris_proxy: DBusProxy, player_proxy: DBusProxy)#

A media player object.

signal closed#

Emitted when a player has been closed or removed.

gproperty can_control: bool#
  • read-only

Whether the player can be controlled.

gproperty can_go_next: bool#
  • read-only

Whether the player can go to the next track.

gproperty can_go_previous: bool#
  • read-only

Whether the player can go to the previous track.

gproperty can_pause: bool#
  • read-only

Whether the player can pause.

gproperty can_play: bool#
  • read-only

Whether the player can play.

gproperty can_seek: bool#
  • read-only

Whether the player can seek (change position on track in seconds).

gproperty loop_status: str | None#
  • read-only

The current loop status.

gproperty metadata: dict#
  • read-only

A dictionary containing metadata.

gproperty track_id: str | None#
  • read-only

The ID of the current track.

gproperty length: int#
  • read-only

The length of the current track, -1 if not supported by the player.

gproperty art_url: str | None#
  • read-only

The path to the cached art image of the track.

gproperty album: str | None#
  • read-only

The current album name.

gproperty artist: str | None#
  • read-only

The current artist name.

gproperty title: str | None#
  • read-only

The current title of the track.

gproperty url: str | None#
  • read-only

The URL address of the track.

gproperty playback_status: str | None#
  • read-only

The current playback status. Can be "Playing" or "Paused".

gproperty position: int#
  • read-write

The current position in the track in seconds.

async set_position_async(value: int) None#

Asynchronously set position.

Parameters:

value (int) -- The value to set.

Return type:

None

gproperty shuffle: bool#
  • read-only

The shuffle status.

gproperty volume: float#
  • read-only

The volume of the player.

gproperty identity: str | None#
  • read-only

The name of the player (e.g. "Spotify", "firefox").

gproperty desktop_entry: str | None#
  • read-only

The .desktop file of the player.

next() None#

Go to the next track.

Return type:

None

async next_async() None#

Asynchronous version of next().

Return type:

None

previous() None#

Go to the previous track.

Return type:

None

async previous_async() None#

Asynchronous version of previous().

Return type:

None

pause() None#

Pause playback.

Return type:

None

async pause_async() None#

Asynchronous version of pause().

Return type:

None

play() None#

Start playback.

Return type:

None

async play_async() None#

Asynchronous version of play().

Return type:

None

play_pause() None#

Toggle between playing and pausing.

Return type:

None

async play_pause_async() None#

Asynchronous version of play_pause().

Return type:

None

stop() None#

Stop playback and remove the MPRIS interface if supported by the player.

Return type:

None

async stop_async() None#

Asynchronous version of stop().

Return type:

None

seek(offset: int) None#

Seek to a specific position in the track. Positive values move forward, and negative values move backward. The offset is in milliseconds.

Return type:

None

async seek_async(offset: int) None#

Asynchronous version of seek().

Return type:

None