player

package
v0.0.0-...-447c52b Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ControlCommand

type ControlCommand struct {
	Command     string
	VolumeDelta int
}

type MpdPlayer

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

Implement Player interface with MPD backend

func NewMpdPlayer

func NewMpdPlayer(conf *config.Config) (player MpdPlayer, err error)

func (MpdPlayer) AddAlbum

func (player MpdPlayer) AddAlbum(album *model.Album) (err error)

func (MpdPlayer) AddTrack

func (player MpdPlayer) AddTrack(track *model.Track) (err error)

func (MpdPlayer) AddTracks

func (player MpdPlayer) AddTracks(tracks []*model.Track) (err error)

func (MpdPlayer) Clear

func (player MpdPlayer) Clear() (err error)

func (*MpdPlayer) Close

func (player *MpdPlayer) Close() (err error)

func (*MpdPlayer) GetCollection

func (player *MpdPlayer) GetCollection() (collection *model.Collection, err error)

these can all be defined on Player

func (*MpdPlayer) HandleControlCommand

func (player *MpdPlayer) HandleControlCommand(cmd *ControlCommand) (err error)

func (*MpdPlayer) HandlePlaylistCommand

func (player *MpdPlayer) HandlePlaylistCommand(cmd *PlaylistCommand) (err error)

func (MpdPlayer) List

func (player MpdPlayer) List() (results []PlaylistTrack, err error)

*

  • Implement playlist interface via mpd

func (MpdPlayer) Next

func (player MpdPlayer) Next() (err error)

func (MpdPlayer) Pause

func (player MpdPlayer) Pause() (err error)

func (MpdPlayer) Play

func (player MpdPlayer) Play() (err error)

func (MpdPlayer) Prev

func (player MpdPlayer) Prev() (err error)

func (*MpdPlayer) Reconnect

func (player *MpdPlayer) Reconnect() (err error)

func (*MpdPlayer) RefreshCollection

func (player *MpdPlayer) RefreshCollection() (model.Collection, error)

func (*MpdPlayer) Status

func (player *MpdPlayer) Status() (status PlayerStatus, err error)

func (MpdPlayer) Stop

func (player MpdPlayer) Stop() (err error)

func (MpdPlayer) VolumeDelta

func (player MpdPlayer) VolumeDelta(volumeDelta int) (err error)

type Player

type Player interface {
	GetCollection() (*model.Collection, error)
	RefreshCollection() (model.Collection, error)

	// Playlist methods
	List() ([]PlaylistTrack, error)
	AddAlbum(*model.Album) error
	AddTrack(*model.Track) error
	AddTracks([]*model.Track) error
	Clear() error

	// Player control methods
	Status() (status PlayerStatus, err error)
	HandleControlCommand(cmd *ControlCommand) error
	HandlePlaylistCommand(cmd *PlaylistCommand) error

	// Cleanup
	Close() error
}

In theory we could have different backends, so define an interface that will allow for that.

type PlayerStatus

type PlayerStatus struct {
	State         string
	Volume        int
	CurrentArtist string
	CurrentAlbum  string
	CurrentTrack  string
	Elapsed       int
	Length        int
}

What we return when we ask for current status

type PlaylistCommand

type PlaylistCommand struct {
	Command   string
	Category  string
	Artist    string
	Album     string
	Track     string
	Immediate bool
}

type PlaylistTrack

type PlaylistTrack struct {
	Pos     string
	Name    string
	Artist  string
	Album   string
	Path    string
	Backend string
}

What we return to describe the current playlist

Jump to

Keyboard shortcuts

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