Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadSubdir = errors.New("cardcpx: importer: invalid subdirectory")

ErrBadSubdir is returned from the status when attempting to import into a bad subdirectory.

Functions

This section is empty.

Types

type Importer

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

An Importer copies files from a video source to video storage.

func New

func New(s video.Storage) *Importer

New returns an importer that copies to storage s.

func (*Importer) Import

func (imp *Importer) Import(src video.Source, subdir string, clips []*video.Clip) *Status

Import copies the files specified by clips from src into its storage.

func (*Importer) Status

func (imp *Importer) Status() *Status

Status returns the current status of the importer. This method is safe to call from multiple goroutines.

type Result

type Result struct {
	Clip  *video.Clip
	Error error
	Start time.Time
	End   time.Time
}

Result stores the final result of a clip's import.

func (*Result) MarshalJSON

func (r *Result) MarshalJSON() ([]byte, error)

type Status

type Status struct {
	Active      bool          `json:"active"`
	BytesCopied int64         `json:"bytesCopied"`
	BytesTotal  int64         `json:"bytesTotal"`
	Start       time.Time     `json:"start"`
	ETA         time.Time     `json:"eta"`
	Pending     []*video.Clip `json:"pending"`
	Results     []Result      `json:"results"`
}

Status stores the state of an importer.

Source Files