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))
player_added(*args)#
  • Signal

Emitted when a player has been added.

Parameters:

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

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

A list of currently active players.

class ignis.services.mpris.MprisPlayer(name: str)#

A media player object.

closed()#
  • Signal

Emitted when a player has been closed or removed.

property can_control: bool#
  • read-only

Whether the player can be controlled.

property can_go_next: bool#
  • read-only

Whether the player can go to the next track.

property can_go_previous: bool#
  • read-only

Whether the player can go to the previous track.

property can_pause: bool#
  • read-only

Whether the player can pause.

property can_play: bool#
  • read-only

Whether the player can play.

property can_seek: bool#
  • read-only

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

property loop_status: str#
  • read-only

The current loop status.

property metadata: dict#
  • read-only

A dictionary containing metadata.

property track_id: str#
  • read-only

The ID of the current track.

property length: int#
  • read-only

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

property art_url: str | None#
  • read-only

The path to the cached art image of the track.

property album: str | None#
  • read-only

The current album name.

property artist: str | None#
  • read-only

The current artist name.

property title: str | None#
  • read-only

The current title of the track.

property url: str | None#
  • read-only

The URL address of the track.

property playback_status: str#
  • read-only

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

property position: int#
  • read-write

The current position in the track in seconds.

property shuffle: bool#
  • read-only

The shuffle status.

property volume: float#
  • read-only

The volume of the player.

property identity: str#
  • read-only

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

property desktop_entry: str#
  • read-only

The .desktop file of the player.

next() None#

Go to the next track.

Return type:

None

previous() None#

Go to the previous track.

Return type:

None

pause() None#

Pause playback.

Return type:

None

play() None#

Start playback.

Return type:

None

play_pause() None#

Toggle between playing and pausing.

Return type:

None

stop() None#

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

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