state_handler

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: MIT Imports: 11 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 {
	CtrlPaused()
	CtrlResume()
	CtrlStop()
	CtrlToggle()
	CtrlNext()
	CtrlPrevious()
	CtrlSeek(duration time.Duration)
	CtrlSetVolume(volume int)
}

type Handler

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

func NewHandler

func NewHandler(p Controller, nowInfo PlayingInfo) *Handler

func (*Handler) IntrospectNode

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

func (*Handler) Release

func (s *Handler) Release()

func (*Handler) SetPlayingInfo

func (s *Handler) SetPlayingInfo(info PlayingInfo)

type MediaPlayer2

type MediaPlayer2 struct {
	*Handler
}

func (*MediaPlayer2) Quit

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

func (*MediaPlayer2) Raise

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

type MetadataMap

type MetadataMap map[string]interface{}

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 player.State) (PlaybackStatus, error)

type Player

type Player struct {
	*Handler
	// 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          player.State
	Volume         int
	TrackID        string
	PicUrl         string
	Name           string
	Artist         string
	Album          string
}

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