Documentation
¶
Index ¶
- func CheckLogin(w http.ResponseWriter, r *http.Request) (*sessions.Session, bool, error)
- func Listen(ctx context.Context, devs []string, p *Player) []error
- func LoginHandler(p *Player) http.HandlerFunc
- func LogoutHandler(w http.ResponseWriter, r *http.Request)
- func NewServer(p *Player, addr string) *http.Server
- func Start(plr *Player)
- type APIHandler
- type Browser
- type Chrome
- func (c *Chrome) AudioStream(a int) error
- func (c *Chrome) Chapter(chp int) error
- func (c *Chrome) Close() error
- func (c *Chrome) Listen(s chan string) error
- func (c *Chrome) Open(file string, status chan string, test string, debug bool) error
- func (c *Chrome) Pause() error
- func (c *Chrome) Play() error
- func (c *Chrome) PlaybackRate(rate int) error
- func (c *Chrome) Seek(seconds int) error
- func (c *Chrome) SubtitleStream(s int) error
- func (c *Chrome) Volume(v int) error
- type Config
- type ConnectionWS
- type Item
- type ItemString
- type Login
- type OMXPlayer
- func (o *OMXPlayer) AudioStream(index int) error
- func (o *OMXPlayer) Chapter(index int) error
- func (o *OMXPlayer) Close() error
- func (o *OMXPlayer) Open(filename string, status chan string, test string, debug bool) error
- func (o *OMXPlayer) Pause() error
- func (o *OMXPlayer) Play() error
- func (o *OMXPlayer) PlaybackRate(speed int) error
- func (o *OMXPlayer) Seek(direction int) error
- func (o *OMXPlayer) SubtitleStream(index int) error
- func (o *OMXPlayer) Volume(vol int) error
- type Player
- func (p *Player) FirstRun()
- func (p *Player) HandleControl(w http.ResponseWriter, r *http.Request)
- func (p *Player) HandleViewer(w http.ResponseWriter, r *http.Request)
- func (p *Player) Listen(s chan string)
- func (p *Player) Next() error
- func (p *Player) Previous() error
- func (p *Player) ServeHTTP(w http.ResponseWriter, h *http.Request)
- func (p *Player) Start(w *http.ResponseWriter)
- type Player2
- type Playlist
- type Presentation
- type Streamer
- type TemplateHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckLogin ¶
CheckLogin checks if the user is logged in
func Listen ¶ added in v0.1.5
Listen to all the Input Devices supplied. Return an error if there is a problem, or if one of the devices disconnects.
func LoginHandler ¶
func LoginHandler(p *Player) http.HandlerFunc
LoginHandler handles login requests
func LogoutHandler ¶
func LogoutHandler(w http.ResponseWriter, r *http.Request)
LogoutHandler logs a user out and redirects them to the login page
Types ¶
type APIHandler ¶
type APIHandler struct {
// contains filtered or unexported fields
}
APIHandler handles requests to the API
func NewAPIHandler ¶
func NewAPIHandler(debug bool, test *string, statAssets, statTemplates embed.FS) APIHandler
NewAPIHandler creates a new APIHandler
func (*APIHandler) Handle ¶
func (a *APIHandler) Handle(p *Player) http.HandlerFunc
Handle handles all calls to the API
type Browser ¶
type Browser struct {
// contains filtered or unexported fields
}
Browser represents the chromium process that is used to display web pages and still images to the screen
type Chrome ¶ added in v0.1.1
type Chrome struct { Supports []string ConnViewer ConnectionWS ConnControl ConnectionWS // contains filtered or unexported fields }
Chrome represents Google Chrome as the video stream playback software. It implements the streamer interface.
func (*Chrome) AudioStream ¶ added in v0.1.1
AudioStream sets the video audio stream.
func (*Chrome) Open ¶ added in v0.1.1
Open starts Chrome in the relevant page with the relevant flags.
func (*Chrome) PlaybackRate ¶ added in v0.1.1
PlaybackRate sets the video playback rate.
func (*Chrome) SubtitleStream ¶ added in v0.1.1
SubtitleStream sets the video subtitle stream.
type Config ¶
type Config struct { Location string Mount mount AudioOutput string Streamer string Debug bool Login Login Remote remote }
Config holds the configuration of the pi-player
func ConfigLoad ¶ added in v0.1.8
Load reads the config file and unmarshalls it to the config struct
func (*Config) SettingsHandler ¶ added in v0.1.1
func (conf *Config) SettingsHandler(p *Player) http.HandlerFunc
SettingsHandler handles requests to the settings page
type ConnectionWS ¶
type ConnectionWS interface { HandlerWebsocket(p *Player) http.HandlerFunc // contains filtered or unexported methods }
ConnectionWS represents a WebSocket connection.
func NewConnWS ¶ added in v0.1.2
func NewConnWS() ConnectionWS
NewConnWS returns a new websocket connection struct.
type Item ¶
Item represents a playlist item it can have a visual element, an audio element, or both. more elements such as timers can be added later.
func (*Item) String ¶
func (i *Item) String() ItemString
String returns an newly created ItemString version of the Item.
type ItemString ¶
ItemString is a simpler representation of an Item, where only the file name for the Audio and Visual elements are stored.
type OMXPlayer ¶ added in v0.1.1
type OMXPlayer struct { Supports []string // contains filtered or unexported fields }
OMXPlayer uses OMXPlayer to stream H.264 files to the screen. It implements the Streamer interface.
func (*OMXPlayer) AudioStream ¶ added in v0.1.1
AudioStream sets the specified video audio stream.
func (*OMXPlayer) PlaybackRate ¶ added in v0.1.1
PlaybackRate sets the video playback speed.
func (*OMXPlayer) SubtitleStream ¶ added in v0.1.1
SubtitleStream sets the subtitle stream.
type Player ¶
type Player struct { ConnViewer ConnectionWS ConnControl ConnectionWS Server *http.Server // contains filtered or unexported fields }
Player is the object that renders images to the screen through omxplayer or chromium
func NewPlayer ¶
func NewPlayer(api *APIHandler, conf *Config, keylogger *keylogger.KeyLogger) *Player
NewPlayer creates a new Player server *http.Server, router *mux.Router
func (*Player) FirstRun ¶
func (p *Player) FirstRun()
FirstRun starts the browser on a black screen and gets things going
func (*Player) HandleControl ¶
func (p *Player) HandleControl(w http.ResponseWriter, r *http.Request)
HandleControl Scan the folder for new files every time the page reloads and display contents
func (*Player) HandleViewer ¶
func (p *Player) HandleViewer(w http.ResponseWriter, r *http.Request)
HandleViewer handles requests to the image viewer page This handler has a dependency on Playlist.
func (*Player) ServeHTTP ¶
func (p *Player) ServeHTTP(w http.ResponseWriter, h *http.Request)
Handles requets to the player api
func (*Player) Start ¶
func (p *Player) Start(w *http.ResponseWriter)
Start the file that will be played in the browser. Sends a message to the ConnViewer channel to be sent over the websocket.
type Player2 ¶ added in v0.1.1
type Player2 interface { Start(i Item) Stop() error Next() error Previous() error Listen(s chan string) }
Player2 represents the entire program. It's the shell that holds the components together. The other components are the Streamer, Playlist, and Remote
type Playlist ¶
type Playlist struct { Name string Items []Item Current *Item // contains filtered or unexported fields }
Playlist stores the media items that can be played.
type Presentation ¶ added in v0.1.1
type Presentation struct {
Items []ItemString
}
Presentation is used to read the presentation.json file for added cues.
type Streamer ¶ added in v0.1.1
type Streamer interface { Open(file string, status chan string, test string, debug bool) error Close() error Play() error Pause() error PlaybackRate(rate int) error Seek(seconds int) error Chapter(chapter int) error Volume(volume int) error AudioStream(stream int) error SubtitleStream(stream int) error }
Streamer represents a program that can decode a media file for display. It is the code that actually plays a media file. Eg: OMXPlayer, VLC and Chrome.
type TemplateHandler ¶
type TemplateHandler struct {
// contains filtered or unexported fields
}
TemplateHandler handles rendering html templates
func NewTemplateHandler ¶
func NewTemplateHandler(filename string, statTemplates fs.FS) TemplateHandler
NewTemplateHandler returns a new template handler for a specific page
func (*TemplateHandler) ServeHTTP ¶
func (t *TemplateHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles HTTP requests for the templates