imgrec

package
v0.0.0-...-efe4ef5 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package imgrec contains an image recorder used to automatically save images to disk.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPWrapper

type HTTPWrapper struct {
	*Recorder
}

HTTPWrapper is an HTTP wrapper around an image recorder that allows the folder and prefix to be changed on the fly

it does not implement generichttp.HTTPer, offering an Inject method allowing it to be injected into another HTTPer

func NewHTTPWrapper

func NewHTTPWrapper(r *Recorder) HTTPWrapper

NewHTTPWrapper returns an HTTP wrapper around a recorder

func (HTTPWrapper) GetEnabled

func (h HTTPWrapper) GetEnabled(w http.ResponseWriter, r *http.Request)

GetEnabled returns the Recorder's Enabled field

func (HTTPWrapper) GetPrefix

func (h HTTPWrapper) GetPrefix(w http.ResponseWriter, r *http.Request)

GetPrefix gets the recorder's prefix and sends it back as JSON

func (HTTPWrapper) GetRoot

func (h HTTPWrapper) GetRoot(w http.ResponseWriter, r *http.Request)

GetRoot gets the recorder's root folder and sends it back as JSON

func (HTTPWrapper) Inject

func (h HTTPWrapper) Inject(rt generichttp.RouteTable)

Inject adds GET and POST routes for /autorwrite/root and /autowrite/prefix to the HTTPer which manipulate this wrapper's recorder

func (HTTPWrapper) SetEnabled

func (h HTTPWrapper) SetEnabled(w http.ResponseWriter, r *http.Request)

SetEnabled sets the recorder's Enabled field

func (HTTPWrapper) SetPrefix

func (h HTTPWrapper) SetPrefix(w http.ResponseWriter, r *http.Request)

SetPrefix updates the filename prefix of the recorder

func (HTTPWrapper) SetRoot

func (h HTTPWrapper) SetRoot(w http.ResponseWriter, r *http.Request)

SetRoot updates the root folder of the recorder

type Recorder

type Recorder struct {

	// Root is the root path
	Root string

	// Prefix is the prefix for the filenames
	Prefix string

	// Enabled is a flag unused by this struct that allows consumers to disable its use in their code
	Enabled bool
	// contains filtered or unexported fields
}

Recorder records image sequences with incrementing filenames in yyyy-mm-dd subfolders. It is not thread safe.

func (*Recorder) Incr

func (r *Recorder) Incr()

Incr updates the filename counter; it scans the folder to do so. If there is an error, the counter is not incremented

func (*Recorder) Write

func (r *Recorder) Write(p []byte) (n int, err error)

Write implements io.Writer and writes the contents of a fits file to disk

Jump to

Keyboard shortcuts

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