ipc

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PingPath      = "/ping"
	PlayPath      = "/transport/play"
	PlayPausePath = "/transport/playpause"
	PausePath     = "/transport/pause"
	StopPath      = "/transport/stop"
	PreviousPath  = "/transport/previous"
	NextPath      = "/transport/next"
	TimePosPath   = "/transport/timepos" // ?s=<seconds>
	SeekByPath    = "/transport/seek-by" // ?s=<+/- seconds>
	VolumePath    = "/volume"            // ?v=<vol>
	ShowPath      = "/window/show"
	QuitPath      = "/window/quit"
)

Variables

View Source
var ErrPingFail = errors.New("ping failed")

Functions

func DestroyConn

func DestroyConn() error

func Dial

func Dial() (net.Conn, error)

func Listen

func Listen() (net.Listener, error)

func SeekBySecondsPath

func SeekBySecondsPath(secs float64) string

func SeekToSecondsPath

func SeekToSecondsPath(secs float64) string

func SetVolumePath

func SetVolumePath(vol int) string

Types

type Client

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

func Connect

func Connect() (*Client, error)

Connect attempts to connect to the IPC socket as client.

func (*Client) Pause

func (c *Client) Pause() error

func (*Client) Ping

func (c *Client) Ping() error

func (*Client) Play

func (c *Client) Play() error

func (*Client) PlayPause

func (c *Client) PlayPause() error

func (*Client) Quit

func (c *Client) Quit() error

func (*Client) SeekBackOrPrevious

func (c *Client) SeekBackOrPrevious() error

func (*Client) SeekBySeconds

func (c *Client) SeekBySeconds(secs float64) error

func (*Client) SeekNext

func (c *Client) SeekNext() error

func (*Client) SeekSeconds

func (c *Client) SeekSeconds(secs float64) error

func (*Client) SetVolume

func (c *Client) SetVolume(vol int) error

func (*Client) Show

func (c *Client) Show() error

type IPCServer

type IPCServer interface {
	Serve(net.Listener) error
	Shutdown(context.Context) error
}

func NewServer

func NewServer(pbHandler PlaybackHandler, showFn, quitFn func()) IPCServer

type PlaybackHandler

type PlaybackHandler interface {
	PlayPause() error
	Stop() error
	Pause() error
	Continue() error
	SeekBackOrPrevious() error
	SeekNext() error
	SeekSeconds(float64) error
	SeekBySeconds(float64) error
	Volume() int
	SetVolume(int) error
}

type Response

type Response struct {
	Error string `json:"error"`
}

Jump to

Keyboard shortcuts

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