api

package
v0.0.0-...-0cbbf0d Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package api provides data model interfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	// Db returns the PMS database.
	Db() *db.Instance

	// Library returns the current MPD library, or nil if it has not been retrieved yet.
	Library() *songlist.Library

	// ListChanged notifies the UI that the current songlist has changed.
	ListChanged()

	// OptionChanged notifies that an option has been changed.
	OptionChanged(string)

	// Message sends a message to the user through the statusbar.
	Message(string, ...interface{})

	// MpdClient returns the current MPD client, which is confirmed to be alive. If the MPD connection is not working, nil is returned.
	MpdClient() *mpd.Client

	// Multibar returns the Multibar widget.
	Multibar() MultibarWidget

	// Options returns PMS' global options.
	Options() *options.Options

	// PlayerStatus returns the current MPD player status.
	PlayerStatus() pms_mpd.PlayerStatus

	// Queue returns MPD's song queue.
	Queue() *songlist.Queue

	// Quit shuts down PMS.
	Quit()

	// Sequencer returns a pointer to the key sequencer that receives key events.
	Sequencer() *keys.Sequencer

	// Song returns the currently playing song, or nil if no song is loaded.
	// Note that the song might be stopped, and the play/pause/stop status should
	// be checked using PlayerStatus().
	Song() *song.Song

	// Songlist returns the visible songlist.
	Songlist() songlist.Songlist

	// SonglistWidget returns the songlist widget.
	SonglistWidget() SonglistWidget

	// Styles returns the current stylesheet.
	Styles() style.Stylesheet

	// UI returns the global UI object.
	UI() UI
}

API defines a set of commands that should be available to commands run through the command-line interface.

func BaseAPI

func BaseAPI(
	db func() *db.Instance,
	eventList chan int,
	eventMessage chan message.Message,
	eventOption chan string,
	library func() *songlist.Library,
	mpdClient func() *mpd.Client,
	multibar func() MultibarWidget,
	options *options.Options,
	playerStatus func() pms_mpd.PlayerStatus,
	queue func() *songlist.Queue,
	quitSignal chan int,
	sequencer *keys.Sequencer,
	song func() *song.Song,
	songlistWidget func() SonglistWidget,
	styles style.Stylesheet,
	ui func() UI,

) API

func NewTestAPI

func NewTestAPI() API

type Collection

type Collection interface {
	Activate(songlist.Songlist)
	ActivateIndex(int) error
	Add(songlist.Songlist)
	Current() songlist.Songlist
	Index() (int, error)
	Last() songlist.Songlist
	Len() int
	Remove(int) error
	ValidIndex(int) bool
}

type MultibarWidget

type MultibarWidget interface {
	Mode() int
	SetMode(int) error
}

type SonglistWidget

type SonglistWidget interface {
	GetVisibleBoundaries() (int, int)
	ScrollViewport(int, bool)
	Size() (int, int)
}

type UI

type UI interface {
	PostFunc(func())
	Refresh()
}

Jump to

Keyboard shortcuts

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