Documentation ¶
Index ¶
- func CheckLogin(w http.ResponseWriter, r *http.Request) (*sessions.Session, bool, error)
- func LoginHandler(conf *Config) http.HandlerFunc
- func LogoutHandler(w http.ResponseWriter, r *http.Request)
- type APIHandler
- type Browser
- type Config
- type ConnectionWS
- type Item
- type ItemString
- type Login
- type Player
- func (p *Player) CleanUp()
- 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) HandleWebSocketMessage()
- func (p *Player) ServeHTTP(w http.ResponseWriter, h *http.Request)
- func (p *Player) Start(w *http.ResponseWriter)
- type Playlist
- type TemplateHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckLogin ¶
CheckLogin checks if the user is logged in
func LoginHandler ¶
func LoginHandler(conf *Config) 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) 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-browser process that is used to display web pages and still images to the screen
type Config ¶
type Config struct { Location string Directory string AudioOutput string Debug bool Login Login Remote remote }
Config holds the configuration of the pi-player
func (*Config) HandleSettings ¶
func (conf *Config) HandleSettings(w http.ResponseWriter, r *http.Request)
HandleSettings handles requests to the settings page
type ConnectionWS ¶
type ConnectionWS struct {
// contains filtered or unexported fields
}
ConnectionWS represents a WebSocket connection.
func (*ConnectionWS) HandlerWebsocket ¶
func (c *ConnectionWS) HandlerWebsocket(p *Player) http.HandlerFunc
HandlerWebsocket handles websocket connections for the browser viewer and controller.
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 Player ¶
type Player struct { ConnViewer ConnectionWS ConnControl ConnectionWS // contains filtered or unexported fields }
Player is the object that renders images to the screen through omxplayer or chromium-browser
func NewPlayer ¶
func NewPlayer(api *APIHandler, conf *Config, keylogger *keylogger.KeyLogger) *Player
NewPlayer creates a new Player
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
func (*Player) HandleWebSocketMessage ¶
func (p *Player) HandleWebSocketMessage()
HandleWebSocketMessage handles messages from ConnectionWS that come from the browser's websocket connection
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 Playlist ¶
Playlist stores the media items that can be played
func NewPlaylist ¶
NewPlaylist creates a new playlist with media in the designated folder.
type TemplateHandler ¶
type TemplateHandler struct {
// contains filtered or unexported fields
}
TemplateHandler handles rendering html templates
func NewTemplateHandler ¶
func NewTemplateHandler(filename string) 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