client

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT-0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithData added in v0.7.0

func ContextWithData(ctx context.Context, data Data) context.Context

ContextWithData returns a subcontext with the data.

Types

type Client

type Client interface {
	Close() error
	Data() (Data, error)
	MusicDir() (string, error)
	PostEvents(ctx context.Context)
	TogglePause() bool
}

Client is an interface implemented by all clients.

type Data added in v0.7.0

type Data struct {
	Song
	Status
	*lyrics.Lyrics
}

Data is an aggregate type for Song, Status and lyrics.Lyrics.

func DataFromContext added in v0.7.0

func DataFromContext(ctx context.Context) Data

DataFromContext returns the Data in ctx.

type MPDClient added in v0.6.0

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

MPDClient implents a Client for the Music Player Daemon (MPD).

func NewMPDClient added in v0.6.0

func NewMPDClient(conntype, addr, passwd, lyricsdir *string) (*MPDClient, error)

NewMPDClient returns a pointer to an instance of MPDClient. A password of "" can be used if there is no password.

func (*MPDClient) Close added in v0.7.0

func (c *MPDClient) Close() error

Close finalilly closes the connection.

func (*MPDClient) Data added in v0.7.0

func (c *MPDClient) Data() (Data, error)

Data returns Data for the currectly playing song.

func (*MPDClient) MusicDir added in v0.6.0

func (c *MPDClient) MusicDir() (string, error)

MusicDir return the music directory, if available.

func (*MPDClient) Ping added in v0.6.0

func (c *MPDClient) Ping() error

Ping sends no-op message.

func (*MPDClient) PostEvents added in v0.7.0

func (c *MPDClient) PostEvents(ctx context.Context)

PostEvents listens for events, and forwards them to events.PostEvent.

func (*MPDClient) TogglePause added in v0.7.1

func (c *MPDClient) TogglePause() bool

TogglePause toggles the pause state.

type MPDSong added in v0.6.0

type MPDSong mpd.Attrs

MPDSong implements Song.

func (MPDSong) Album added in v0.6.0

func (s MPDSong) Album() string

Album returns the song Album.

func (MPDSong) Artist added in v0.6.0

func (s MPDSong) Artist() string

Artist returns the song artist.

func (MPDSong) Date added in v0.6.0

func (s MPDSong) Date() string

Date returns the song Date.

func (MPDSong) File added in v0.6.0

func (s MPDSong) File() string

File returns the song File.

func (MPDSong) ID added in v0.6.0

func (s MPDSong) ID() string

ID returns the song id.

func (MPDSong) Title added in v0.6.0

func (s MPDSong) Title() string

Title returns the song title.

type MPDStatus added in v0.6.0

type MPDStatus map[string]string

MPDStatus implements Status.

func (MPDStatus) Consume added in v0.6.0

func (s MPDStatus) Consume() bool

Consume returns consume option.

func (MPDStatus) Duration added in v0.6.0

func (s MPDStatus) Duration() time.Duration

Duration returns the player song duration.

func (MPDStatus) Elapsed added in v0.6.0

func (s MPDStatus) Elapsed() time.Duration

Elapsed returns the pleyer elapsed duration.

func (MPDStatus) Random added in v0.6.0

func (s MPDStatus) Random() bool

Random returns random option.

func (MPDStatus) Repeat added in v0.6.0

func (s MPDStatus) Repeat() bool

Repeat returns repeat option.

func (MPDStatus) Single added in v0.6.0

func (s MPDStatus) Single() bool

Single returns single option.

func (MPDStatus) State added in v0.6.0

func (s MPDStatus) State() string

State returns the player state. "pause", "play".

type OptionsEvent added in v0.7.0

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

OptionsEvent occurs when an option in the music player changes.

type PlayerEvent added in v0.7.0

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

PlayerEvent occurs when the state of the music player changes.

type Song added in v0.6.0

type Song interface {
	ID() string
	Title() string
	Artist() string
	Album() string
	Date() string
	File() string
}

Song contains data about a playing in the music player.

type Status added in v0.6.0

type Status interface {
	Duration() time.Duration
	Elapsed() time.Duration
	State() string
	Repeat() bool
	Random() bool
	Single() bool
	Consume() bool
}

Status contains data about status of the music player.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳