mpris

package
v1.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DebugPlayerInfo added in v1.10.0

type DebugPlayerInfo struct {
	DisplayName    string `json:"displayName"`
	BusName        string `json:"busName"`
	ShortName      string `json:"shortName"`
	Title          string `json:"title"`
	Artist         string `json:"artist"`
	Album          string `json:"album"`
	PlaybackStatus string `json:"playbackStatus"`
	IsPlaying      bool   `json:"isPlaying"`
	Volume         int    `json:"volume"`
	Pos            int64  `json:"pos"`
	Length         int64  `json:"length"`
	AlbumArtUrl    string `json:"albumArtUrl"`
	CanSeek        bool   `json:"canSeek"`
	CanGoNext      bool   `json:"canGoNext"`
	CanGoPrevious  bool   `json:"canGoPrevious"`
	CanPlay        bool   `json:"canPlay"`
	CanPause       bool   `json:"canPause"`
	Error          string `json:"error,omitempty"`
}

type DebugStatus added in v1.10.0

type DebugStatus struct {
	WatcherRunning bool              `json:"watcherRunning"`
	DeviceCount    int               `json:"deviceCount"`
	Players        []DebugPlayerInfo `json:"players"`
	PlayerMappings map[string]string `json:"playerMappings"`
}

type MPRISPlugin

type MPRISPlugin struct {
	// contains filtered or unexported fields
}

func NewMPRISPlugin

func NewMPRISPlugin(tlsConfig *tls.Config, bus *events.Bus, pauseMusic bool, logger *zap.Logger) *MPRISPlugin

func (*MPRISPlugin) ActivePlayers added in v1.11.0

func (p *MPRISPlugin) ActivePlayers() []string

ActivePlayers returns the list of player names from all remote device states.

func (*MPRISPlugin) DebugStatus added in v1.10.0

func (p *MPRISPlugin) DebugStatus() *DebugStatus

func (*MPRISPlugin) Handle

func (p *MPRISPlugin) Handle(ctx context.Context, dev device.Sender, pkt *protocol.Packet) error

func (*MPRISPlugin) IncomingTypes

func (p *MPRISPlugin) IncomingTypes() []string

func (*MPRISPlugin) Name

func (p *MPRISPlugin) Name() string

func (*MPRISPlugin) OnConnect

func (p *MPRISPlugin) OnConnect(dev device.Sender)

func (*MPRISPlugin) OnDisconnect

func (p *MPRISPlugin) OnDisconnect(dev device.Sender)

func (*MPRISPlugin) OutgoingTypes

func (p *MPRISPlugin) OutgoingTypes() []string

func (*MPRISPlugin) RemoteState added in v1.11.0

func (p *MPRISPlugin) RemoteState(deviceID string) *NowPlaying

RemoteState returns the last known NowPlaying state for a remote device, with position extrapolated from the last update time if playing.

func (*MPRISPlugin) RemoteStates added in v1.11.0

func (p *MPRISPlugin) RemoteStates() map[string]*NowPlaying

RemoteStates returns all known remote device player states, with positions extrapolated from the last update time.

func (*MPRISPlugin) RequestState added in v1.11.0

func (p *MPRISPlugin) RequestState(dev device.Sender, player string) error

RequestState sends a requestNowPlaying to refresh remote state.

func (*MPRISPlugin) SendAction added in v1.11.0

func (p *MPRISPlugin) SendAction(dev device.Sender, player, action string, seek *int64, volume *int) error

SendAction sends a media control action to a remote device. Sends on both kdeconnect.mpris (for Android's old MprisPlugin) and kdeconnect.mpris.request (for MprisReceiverPlugin) to maximise compatibility.

func (*MPRISPlugin) Timeout

func (p *MPRISPlugin) Timeout() time.Duration

type MPRISRequest

type MPRISRequest struct {
	// Request fields
	RequestPlayerList bool `json:"requestPlayerList,omitempty"`
	RequestNowPlaying bool `json:"requestNowPlaying,omitempty"`
	RequestVolume     bool `json:"requestVolume,omitempty"`

	// Action fields
	Player        string `json:"player,omitempty"`
	Action        string `json:"action,omitempty"`
	SetVolume     *int   `json:"setVolume,omitempty"`
	Seek          *int64 `json:"Seek,omitempty"`
	SetPosition   *int64 `json:"SetPosition,omitempty"`
	SetShuffle    *bool  `json:"setShuffle,omitempty"`
	SetLoopStatus string `json:"setLoopStatus,omitempty"`

	// Album art
	AlbumArtUrl string `json:"albumArtUrl,omitempty"`

	// Player list from remote device
	PlayerList []string `json:"playerList,omitempty"`

	// NowPlaying fields — populated when phone sends state update
	Title          string `json:"title,omitempty"`
	Artist         string `json:"artist,omitempty"`
	Album          string `json:"album,omitempty"`
	Url            string `json:"url,omitempty"`
	Length         int64  `json:"length,omitempty"`
	Pos            int64  `json:"pos,omitempty"`
	IsPlaying      bool   `json:"isPlaying,omitempty"`
	Volume         int    `json:"volume,omitempty"`
	CanControl     bool   `json:"canControl,omitempty"`
	CanGoNext      bool   `json:"canGoNext,omitempty"`
	CanGoPrevious  bool   `json:"canGoPrevious,omitempty"`
	CanPause       bool   `json:"canPause,omitempty"`
	CanPlay        bool   `json:"canPlay,omitempty"`
	CanSeek        bool   `json:"canSeek,omitempty"`
	PlaybackStatus string `json:"playbackStatus,omitempty"`
	Shuffle        *bool  `json:"shuffle,omitempty"`
	LoopStatus     string `json:"loopStatus,omitempty"`
}

type NowPlaying

type NowPlaying struct {
	Player         string `json:"player"`
	Title          string `json:"title"`
	Artist         string `json:"artist"`
	Album          string `json:"album"`
	AlbumArtUrl    string `json:"albumArtUrl"`
	Url            string `json:"url,omitempty"`
	Length         int64  `json:"length"`
	Pos            int64  `json:"pos,omitempty"`
	IsPlaying      bool   `json:"isPlaying"`
	Volume         int    `json:"volume,omitempty"`
	CanControl     bool   `json:"canControl"`
	CanGoNext      bool   `json:"canGoNext"`
	CanGoPrevious  bool   `json:"canGoPrevious"`
	CanPause       bool   `json:"canPause"`
	CanPlay        bool   `json:"canPlay"`
	CanSeek        bool   `json:"canSeek"`
	PlaybackStatus string `json:"playbackStatus"`
	Shuffle        *bool  `json:"shuffle,omitempty"`
	LoopStatus     string `json:"loopStatus,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL