fppclient

package module
v0.0.0-...-48c76de Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: MIT Imports: 12 Imported by: 0

README

FPP Client

A library for accessing FPP from go

This is very much a work in progress, I started it with the intent of testing pixel panels, it will grow with time.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) newArg

Types

type BodyError

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

type ChannelOutput

type ChannelOutput struct {
	Type                string              `json:"type"`
	SubType             string              `json:"subType"`
	Enabled             int                 `json:"enabled"`
	CfgVersion          int                 `json:"cfgVersion"`
	StartChannel        int                 `json:"startChannel"`
	ChannelCount        int                 `json:"channelCount"`
	ColorOrder          string              `json:"colorOrder"`
	Gamma               string              `json:"gamma"`
	WiringPinout        string              `json:"wiringPinout"`
	Brightness          int                 `json:"brightness"`
	PanelColorDepth     int                 `json:"panelColorDepth"`
	InvertedData        int                 `json:"invertedData"`
	PanelWidth          int                 `json:"panelWidth"`
	PanelHeight         int                 `json:"panelHeight"`
	PanelScan           int                 `json:"panelScan"`
	PanelOutputOrder    bool                `json:"panelOutputOrder"`
	PanelOutputBlankRow bool                `json:"panelOutputBlankRow"`
	Panels              ChannelOutputPanels `json:"panels"`
}

type ChannelOutputPanel

type ChannelOutputPanel struct {
	OutputNumber int    `json:"outputNumber"`
	PanelNumber  int    `json:"panelNumber"`
	ColorOrder   string `json:"colorOrder"`
	XOffset      int    `json:"xOffset"`
	YOffset      int    `json:"yOffset"`
	Orientation  string `json:"orientation"`
	Row          int    `json:"row"`
	Col          int    `json:"col"`
}

type ChannelOutputPanels

type ChannelOutputPanels []ChannelOutputPanel

type ChannelOutputs

type ChannelOutputs []ChannelOutput

type ChannelOutputsObj

type ChannelOutputsObj struct {
	ChannelOutputs `json:"channelOutputs"`
}

type Client

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

func New

func New(baseURL string, args ...newArg) (*Client, error)

func (Client) ClearOverlaysModel

func (c Client) ClearOverlaysModel(ctx context.Context, name string) error

func (Client) FillOverlaysModel

func (c Client) FillOverlaysModel(ctx context.Context, name string, r, g, b int) error

func (Client) GetChannelOutputs

func (c Client) GetChannelOutputs(ctx context.Context) (ChannelOutputs, error)

func (Client) GetConfig

func (c Client) GetConfig(ctx context.Context, name string, v interface{}) error

func (Client) GetFPPDSchedule

func (c Client) GetFPPDSchedule(ctx context.Context) (Schedule, error)

func (Client) GetFPPDStatus

func (c Client) GetFPPDStatus(ctx context.Context) (FPPDStatus, error)

func (Client) GetFiles

func (c Client) GetFiles(ctx context.Context, dir string) (files []File, err error)

func (Client) GetOverlaysFonts

func (c Client) GetOverlaysFonts(ctx context.Context) (fonts Fonts, err error)

func (Client) GetOverlaysModel

func (c Client) GetOverlaysModel(ctx context.Context, name string) (*Model, error)

func (Client) GetOverlaysModelData

func (c Client) GetOverlaysModelData(ctx context.Context, name string, rle bool) (*ModelData, error)

func (Client) GetOverlaysModels

func (c Client) GetOverlaysModels(ctx context.Context) (models Models, err error)

func (Client) GetPlaylist

func (c Client) GetPlaylist(ctx context.Context, name string) (playlist Playlist, err error)

func (Client) GetPlaylists

func (c Client) GetPlaylists(ctx context.Context) (playlists []string, err error)

func (Client) GetPlugins

func (c Client) GetPlugins(ctx context.Context) (plugins Plugins, err error)

func (Client) GetSchedule

func (c Client) GetSchedule(ctx context.Context) (schedule []ScheduleEntries, err error)

func (Client) PostCommand

func (c Client) PostCommand(ctx context.Context, cmd Command)

func (Client) PostSchedule

func (c Client) PostSchedule(ctx context.Context, scheduleIn []ScheduleEntries) (schedule []ScheduleEntries, err error)

func (Client) PostScheduleReload

func (c Client) PostScheduleReload(ctx context.Context) (err error)

func (Client) SetOverlaysModelPixel

func (c Client) SetOverlaysModelPixel(ctx context.Context, name string, x, y, r, g, b int) error

func (Client) SetOverlaysModelState

func (c Client) SetOverlaysModelState(ctx context.Context, name string, state interface{}) error

type Command

type Command struct {
	Command string   `json:"command"`
	Args    []string `json:"args"`
}

func CommandInsertPlaylistAfterCurrent

func CommandInsertPlaylistAfterCurrent(playlistName string, startIndex, endIndex int, ifNotRunning bool) Command

type FPPDStatus

type FPPDStatus struct {
	MQTT struct {
		Configured bool `json:"configured"`
		Connected  bool `json:"connected"`
	} `json:"MQTT"`
	Bridging        bool `json:"bridging"`
	CurrentPlaylist struct {
		Count       int    `json:"count,string"`
		Description string `json:"description"`
		Index       int    `json:"index,string"`
		Playlist    string `json:"playlist"`
		Type        string `json:"type"`
	} `json:"current_playlist"`
	CurrentSequence string `json:"current_sequence"`
	CurrentSong     string `json:"current_song"`
	DateStr         string `json:"dateStr"`
	Fppd            string `json:"fppd"`
	Mode            Intish `json:"mode"`
	ModeName        string `json:"mode_name"`
	Multisync       bool   `json:"multisync"`
	NextPlaylist    struct {
		Playlist  string  `json:"playlist"`
		StartTime FPPTime `json:"start_time"`
	} `json:"next_playlist"`
	RepeatMode RepeatMode `json:"repeat_mode"`
	Scheduler  struct {
		Enabled      int `json:"enabled"`
		NextPlaylist struct {
			PlaylistName          string  `json:"playlistName"`
			ScheduledStartTime    FPPTime `json:"scheduledStartTime"`
			ScheduledStartTimeStr string  `json:"scheduledStartTimeStr"`
		} `json:"nextPlaylist"`
		Status string `json:"status"`
	} `json:"scheduler"`
	SecondsPlayed    string `json:"seconds_played"`
	SecondsRemaining string `json:"seconds_remaining"`
	Sensors          []struct {
		Formatted string  `json:"formatted"`
		Label     string  `json:"label"`
		Postfix   string  `json:"postfix"`
		Prefix    string  `json:"prefix"`
		Value     float64 `json:"value"`
		ValueType string  `json:"valueType"`
	} `json:"sensors"`
	Status             int      `json:"status"`
	StatusName         string   `json:"status_name"`
	Time               string   `json:"time"`
	TimeStr            string   `json:"timeStr"`
	TimeStrFull        string   `json:"timeStrFull"`
	TimeElapsed        string   `json:"time_elapsed"`
	TimeRemaining      string   `json:"time_remaining"`
	Uptime             string   `json:"uptime"`
	UptimeDays         float64  `json:"uptimeDays"`
	UptimeHours        float64  `json:"uptimeHours"`
	UptimeMinutes      float64  `json:"uptimeMinutes"`
	UptimeSeconds      int      `json:"uptimeSeconds"`
	UptimeStr          string   `json:"uptimeStr"`
	UptimeTotalSeconds int      `json:"uptimeTotalSeconds"`
	UUID               string   `json:"uuid"`
	Volume             int      `json:"volume"`
	Warnings           []string `json:"warnings"`
}

type FPPTime

type FPPTime struct {
	time.Time
}

func (*FPPTime) UnmarshalJSON

func (e *FPPTime) UnmarshalJSON(b []byte) error

type File

type File struct {
	Name      string `json:"name"`
	Mtime     string `json:"mtime"`
	SizeBytes int    `json:"sizeBytes"`
	SizeHuman string `json:"sizeHuman"`
}

type Files

type Files struct {
	Status string `json:"status"`
	Files  []File `json:"files"`
}

type Fonts

type Fonts []string

type Intish

type Intish int

A Intish is an int that can be unmarshalled from a JSON field that has either a number or a string value. E.g. if the json field contains an string "42", the FlexInt value will be "42".

func (*Intish) UnmarshalJSON

func (fi *Intish) UnmarshalJSON(b []byte) error

type Model

type Model struct {
	ChannelCount        int    `json:"ChannelCount"`
	ChannelCountPerNode int    `json:"ChannelCountPerNode"`
	Name                string `json:"Name"`
	Orientation         string `json:"Orientation"`
	StartChannel        int    `json:"StartChannel"`
	StartCorner         string `json:"StartCorner"`
	StrandsPerString    int    `json:"StrandsPerString"`
	StringCount         int    `json:"StringCount"`
	Type                string `json:"Type"`
	AutoCreated         bool   `json:"autoCreated"`
	EffectRunning       bool   `json:"effectRunning"`
	Height              int    `json:"height"`
	IsActive            int    `json:"isActive"`
	Width               int    `json:"width"`
}

type ModelData

type ModelData struct {
	Data          []int `json:"data"`
	EffectRunning bool  `json:"effectRunning"`
	IsLocked      bool  `json:"isLocked"`
	RLE           bool  `json:"rle"`
}

type Models

type Models []Model

type Playlist

type Playlist struct {
	Name         string            `json:"name"`
	Version      int               `json:"version"`
	Repeat       int               `json:"repeat"`
	LoopCount    int               `json:"loopCount"`
	Empty        bool              `json:"empty"`
	Desc         string            `json:"desc"`
	Random       int               `json:"random"`
	LeadIn       []PlaylistEntries `json:"leadIn"`
	MainPlaylist []PlaylistEntries `json:"mainPlaylist"`
	LeadOut      []PlaylistEntries `json:"leadOut"`
	PlaylistInfo PlaylistInfo      `json:"playlistInfo"`
}

type PlaylistEntries

type PlaylistEntries struct {
	Type         string  `json:"type"`
	Enabled      int     `json:"enabled"`
	PlayOnce     int     `json:"playOnce"`
	SequenceName string  `json:"sequenceName"`
	MediaName    string  `json:"mediaName"`
	VideoOut     string  `json:"videoOut"`
	Duration     float64 `json:"duration"`
}

type PlaylistInfo

type PlaylistInfo struct {
	TotalDuration float64 `json:"total_duration"`
	TotalItems    int     `json:"total_items"`
}

type Plugins

type Plugins []string

func (Plugins) Contains

func (p Plugins) Contains(plugin string) bool

type RepeatMode

type RepeatMode struct {
	Value int
}

func (*RepeatMode) UnmarshalJSON

func (rm *RepeatMode) UnmarshalJSON(data []byte) error

type Schedule

type Schedule struct {
	Enabled int `json:"enabled"`
	Entries []struct {
		Args             []string `json:"args,omitempty"`
		Command          string   `json:"command,omitempty"`
		Day              int      `json:"day"`
		DayStr           string   `json:"dayStr"`
		Enabled          int      `json:"enabled"`
		EndDate          string   `json:"endDate"`
		EndTime          string   `json:"endTime"`
		ID               int      `json:"id"`
		MultisyncCommand bool     `json:"multisyncCommand,omitempty"`
		MultisyncHosts   string   `json:"multisyncHosts,omitempty"`
		Playlist         string   `json:"playlist"`
		Repeat           int      `json:"repeat"`
		RepeatInterval   int      `json:"repeatInterval"`
		StartDate        string   `json:"startDate"`
		StartTime        string   `json:"startTime"`
		StopType         int      `json:"stopType"`
		StopTypeStr      string   `json:"stopTypeStr"`
		Type             string   `json:"type"`
	} `json:"entries"`
	Items []struct {
		Args             []string `json:"args"`
		Command          string   `json:"command"`
		EndTime          int      `json:"endTime"`
		EndTimeStr       string   `json:"endTimeStr"`
		ID               int      `json:"id"`
		MultisyncCommand bool     `json:"multisyncCommand"`
		MultisyncHosts   string   `json:"multisyncHosts"`
		Priority         int      `json:"priority"`
		StartTime        int      `json:"startTime"`
		StartTimeStr     string   `json:"startTimeStr"`
	} `json:"items"`
}

type ScheduleEntries

type ScheduleEntries []struct {
	Enabled          int      `json:"enabled"`
	Sequence         int      `json:"sequence"`
	Day              int      `json:"day"`
	StartTime        string   `json:"startTime"`
	StartTimeOffset  int      `json:"startTimeOffset"`
	EndTime          string   `json:"endTime"`
	EndTimeOffset    int      `json:"endTimeOffset"`
	Repeat           int      `json:"repeat"`
	StartDate        string   `json:"startDate"`
	EndDate          string   `json:"endDate"`
	StopType         int      `json:"stopType"`
	Playlist         string   `json:"playlist"`
	Command          string   `json:"command,omitempty"`
	Args             []string `json:"args,omitempty"`
	MultisyncCommand bool     `json:"multisyncCommand,omitempty"`
}

type ScheduleResponse

type ScheduleResponse struct {
	Status
	RespCode int      `json:"respCode"`
	Schedule Schedule `json:"schedule"`
}

type Status

type Status struct {
	Status  string `json:"Status"`
	Message string `json:"message"`
}

Directories

Path Synopsis
cmd
debug

Jump to

Keyboard shortcuts

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