eventcmd

package
v0.0.0-...-051453a Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventSongStart  = "songstart"
	EventSongFinish = "songfinish"
	EventSongLove   = "songlove"
	EventSongBan    = "songban"

	HandleSongStart EventFlags = 1 << iota
	HandleSongFinish
	HandleSongLove
	HandleSongBan
)

Variables

This section is empty.

Functions

func Handle

func Handle(
	ctx context.Context,
	event string,
	handle EventFlags,
	stdin io.Reader,
	w wal.WAL[pianobar.Track],
	s lastfm.Scrobbler,
	f lastfm.FeedbackProvider,
) (io.Reader, error)

Handle processes a command executed by pianobar's eventcmd interface. First, it checks to see if the provided event is handled based on the set EventFlags. If not, it returns the passed reader and no error.

If the event is enabled, the stdin reader is read fully and the event is handled. Then, a new reader is returned as well as any error from the handling of the event.

In either case, if event chaining is enabled, the returned reader can be used to re-read the eventcmd payload.

Types

type EventFlags

type EventFlags uint8

func (EventFlags) ShouldHandle

func (e EventFlags) ShouldHandle(event string) bool

ShouldHandle returns true iff the correct flag is set for the specified event

Jump to

Keyboard shortcuts

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