Documentation ¶
Overview ¶
Package mpris implements dbus-integration for mpris-interface. It allows any other application to control media players, including jellycli.
Index ¶
- Constants
- type LoopStatus
- type MediaController
- type MetadataMap
- type PlaybackRate
- type PlaybackStatus
- type Player
- func (p *Player) Next() *dbus.Error
- func (p *Player) OnLoopStatus(c *prop.Change) *dbus.Error
- func (p *Player) OnShuffle(c *prop.Change) *dbus.Error
- func (p *Player) OnVolume(c *prop.Change) *dbus.Error
- func (p *Player) Pause() *dbus.Error
- func (p *Player) Play() *dbus.Error
- func (p *Player) PlayPause() *dbus.Error
- func (p *Player) Previous() *dbus.Error
- func (p *Player) Seek(x TimeInUs) *dbus.Error
- func (p *Player) SetPosition(o TrackID, x TimeInUs) *dbus.Error
- func (p *Player) Stop() *dbus.Error
- func (p *Player) UpdateStatus(state interfaces.AudioStatus)
- type TimeInUs
- type TrackID
- type TrackList
- type URI
Constants ¶
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) 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 PlaybackRate ¶
type PlaybackRate float64
PlaybackRate is a playback rate. https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Simple-Type:Playback_Rate
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 ¶
Next skips to the next track in the tracklist. https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Method:Next
func (*Player) OnLoopStatus ¶
OnLoopStatus handles LoopStatus change. https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Property:LoopStatus
func (*Player) OnShuffle ¶
OnShuffle handles Shuffle change. https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Property:Shuffle
func (*Player) Pause ¶
Pause pauses playback. https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Method:Pause
func (*Player) Play ¶
Play starts or resumes playback. https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Method:Play
func (*Player) PlayPause ¶
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 ¶
Previous skips to the previous track in the tracklist. https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Method:Previous
func (*Player) Seek ¶
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 ¶
SetPosition sets the current track position in microseconds. https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Method:SetPosition
func (*Player) Stop ¶
Stop stops playback. https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Method:Stop
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 ¶
UsFromDuration returns the type from a time.Duration
type TrackID ¶
type TrackID string
TrackID is the Unique track identifier. https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Simple-Type:Track_Id
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
type URI ¶
type URI string
URI is an unique resource identifier. https://specifications.freedesktop.org/mpris-spec/latest/Track_List_Interface.html#Simple-Type:Uri