services

package
v0.0.0-...-a757655 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2022 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoPreview raises when no previews found
	ErrNoPreview = errors.New("No preview")
)

Functions

func RegisterS3StorageFlags

func RegisterS3StorageFlags(c *cli.App)

RegisterS3StorageFlags registers S3Storage flags

func RegisterWebFlags

func RegisterWebFlags(c *cli.App)

RegisterWebFlags reigisters flags for web server

Types

type Generator

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

Generator generates previews for video content

func NewGenerator

func NewGenerator(s3 *S3Storage, sourceURL string, offset time.Duration, length time.Duration, infoHash string, path string) *Generator

NewGenerator initializes new Generator instance

func (*Generator) Get

func (s *Generator) Get() (io.Reader, error)

Get gets preview

type GeneratorPool

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

GeneratorPool ensures that only one specific preview is generating at time

func NewGeneratorPool

func NewGeneratorPool(s3 *S3Storage) *GeneratorPool

NewGeneratorPool initializes GeneratorPool

func (*GeneratorPool) Get

func (s *GeneratorPool) Get(sourceURL string, offset time.Duration, length time.Duration, infoHash string, path string) *Generator

Get gets Generator

type S3Storage

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

S3Storage manipulates with previews

func NewS3Storage

func NewS3Storage(c *cli.Context, cl *cs.S3Client) *S3Storage

NewS3Storage initializes S3Storage

func (*S3Storage) GetPreview

func (s *S3Storage) GetPreview(key string) (io.ReadCloser, error)

GetPreview gets preview from S3 storage

func (*S3Storage) PutPreview

func (s *S3Storage) PutPreview(key string, data []byte) error

PutPreview puts preview in S3 storage

type Web

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

Web serves previews for video content

func NewWeb

func NewWeb(c *cli.Context, gp *GeneratorPool) *Web

NewWeb initializes Web

func (*Web) Close

func (s *Web) Close()

Close closes web server

func (*Web) Serve

func (s *Web) Serve() error

Serve serves web server

Jump to

Keyboard shortcuts

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