mpris

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

README

Mpris implementation originally by: Natsu Kagami (MIT licensed).

Documentation

Overview

Package mpris implements dbus-integration for mpris-interface. It allows any other application to control media players, including jellycli.

Index

Constants

View Source
const TrackIDFormat = "/org/mpd/Tracks/%s"

TrackIDFormat is the formatter string for a track ID.

Variables

This section is empty.

Functions

This section is empty.

Types

type LoopStatus

type LoopStatus = string

LoopStatus is a repeat / loop status. https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Enum:Loop_Status

const (
	LoopStatusNone     LoopStatus = "None"
	LoopStatusTrack    LoopStatus = "Track"
	LoopStatusPlaylist LoopStatus = "Playlist"
)

Defined LoopStatuses

type MediaController

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

MediaController manages connection to DBus. It contains a connection to the MPD server and the DBus connection.

func NewController

func NewController(controller interfaces.Player) (c *MediaController, err error)

NewController creates new Mpris controller and connects to DBus.

func (*MediaController) Close

func (m *MediaController) Close() error

Close ends the connection.

func (*MediaController) IntrospectNode

func (m *MediaController) IntrospectNode() *introspect.Node

IntrospectNode returns the root node of the library's introspection output.

func (*MediaController) Name

func (m *MediaController) Name() string

Name returns the name of the instance.

func (*MediaController) Quit

func (m *MediaController) Quit() *dbus.Error

Quit causes the media player to stop running. https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Method:Quit

func (*MediaController) Raise

func (m *MediaController) Raise() *dbus.Error

Raise brings the media player's user interface to the front using any appropriate mechanism available. https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Method:Raise

type MetadataMap

type MetadataMap map[string]interface{}

MetadataMap is a mapping from metadata attribute names to values. https://specifications.freedesktop.org/mpris-spec/latest/Track_List_Interface.html#Mapping:Metadata_Map

type PlaybackStatus

type PlaybackStatus string

PlaybackStatus is a playback state. https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Enum:Playback_Status

const (
	PlaybackStatusPlaying PlaybackStatus = "Playing"
	PlaybackStatusPaused  PlaybackStatus = "Paused"
	PlaybackStatusStopped PlaybackStatus = "Stopped"
)

Defined PlaybackStatuses.

type Player

type Player struct {
	*MediaController
	// contains filtered or unexported fields
}

Player is a DBus object satisfying the `org.mpris.MediaPlayer2.Player` interface. https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html

func (*Player) Next

func (p *Player) Next() *dbus.Error

Next skips to the next track in the tracklist. https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Method:Next

func (*Player) OnLoopStatus

func (p *Player) OnLoopStatus(c *prop.Change) *dbus.Error

OnLoopStatus handles LoopStatus change. https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Property:LoopStatus

func (*Player) OnVolume

func (p *Player) OnVolume(c *prop.Change) *dbus.Error

OnVolume handles volume changes.

func (*Player) PlayPause

func (p *Player) PlayPause() *dbus.Error

PlayPause toggles playback. If playback is already paused, resumes playback. If playback is stopped, starts playback. https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Method:PlayPause

func (*Player) Previous

func (p *Player) Previous() *dbus.Error

Previous skips to the previous track in the tracklist. https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Method:Previous

func (*Player) Seek

func (p *Player) Seek(x TimeInUs) *dbus.Error

Seek seeks forward in the current track by the specified number of microseconds. https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Method:Seek

func (*Player) SetPosition

func (p *Player) SetPosition(o TrackID, x TimeInUs) *dbus.Error

SetPosition sets the current track position in microseconds. https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Method:SetPosition

func (*Player) UpdateStatus

func (p *Player) UpdateStatus(state interfaces.AudioStatus)

UpdateStatus updates status to dbus

type TimeInUs

type TimeInUs int64

TimeInUs is time in microseconds. https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Simple-Type:Time_In_Us

func UsFromDuration

func UsFromDuration(t time.Duration) TimeInUs

UsFromDuration returns the type from a time.Duration

func (TimeInUs) Duration

func (t TimeInUs) Duration() time.Duration

Duration returns the type in time.Duration

type TrackList

type TrackList struct {
	*MediaController
}

TrackList is a DBus object satisfying the `org.mpris.MediaPlayer2.TrackList` interface. https://specifications.freedesktop.org/mpris-spec/latest/TrackList_Interface.html

Jump to

Keyboard shortcuts

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