remote_control

package
v0.0.0-...-5e62797 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller interface {
	CtrlPause()
	CtrlResume()
	CtrlStop()
	CtrlToggle()
	CtrlNext()
	CtrlPrevious()
	CtrlSeek(duration time.Duration)
	CtrlSetVolume(volume int)
}

type MediaPlayer2

type MediaPlayer2 struct {
	*RemoteControl
}

func (*MediaPlayer2) Quit

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

func (*MediaPlayer2) Raise

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

type MetadataMap

type MetadataMap map[string]any

func MapFromPlayingInfo

func MapFromPlayingInfo(info PlayingInfo) MetadataMap

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.

func PlaybackStatusFromPlayer

func PlaybackStatusFromPlayer(state types.State) (PlaybackStatus, error)

type Player

type Player struct {
	*RemoteControl
	// 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) OnVolume

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

OnVolume handles volume changes.

func (*Player) Pause

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

Pause pauses playback. https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Method:Pause

func (*Player) Play

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

Play starts or resumes playback. https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Method:Play

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) Stop

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

Stop stops playback. https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Method:Stop

type PlayingInfo

type PlayingInfo struct {
	TotalDuration  time.Duration
	PassedDuration time.Duration
	State          types.State
	Volume         int
	TrackID        int64
	PicUrl         string
	Name           string
	Artist         string
	Album          string
	AlbumArtist    string
	LRCText        string
}

type RemoteControl

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

func NewRemoteControl

func NewRemoteControl(p Controller, nowInfo PlayingInfo) *RemoteControl

func (*RemoteControl) IntrospectNode

func (s *RemoteControl) IntrospectNode() *introspect.Node

func (*RemoteControl) Release

func (s *RemoteControl) Release()

func (*RemoteControl) SetPlayingInfo

func (s *RemoteControl) SetPlayingInfo(info PlayingInfo)

func (*RemoteControl) SetPosition

func (s *RemoteControl) SetPosition(duration time.Duration)

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

Jump to

Keyboard shortcuts

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