media

package
v0.0.0-...-8f9ce2e Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidFitOptions    = errors.New("invalid fit options")
	ErrInvalidWidthRange    = errors.New("invalid width range")
	ErrWidthNotAllowed      = errors.New("width is not allowed")
	ErrInvalidProcessStatus = errors.New("invalid process status")
)

Functions

func Configure

func Configure(l *goapp.Lifecycle, conf *config.Config)

func ContainsSize

func ContainsSize(size uint, allowed []uint) bool

func HandleImageReader

func HandleImageReader(node *base.Node, v *vault.Vault, r io.Reader, logger *log.Logger) (int64, error)

Types

type ExifMeta

type ExifMeta map[string]string

func GetExif

func GetExif(r io.Reader) (ExifMeta, error)

type ExifWalker

type ExifWalker struct {
	Meta ExifMeta
}

func (*ExifWalker) Walk

func (w *ExifWalker) Walk(name exif.FieldName, tag *tiff.Tag) error

type Image

type Image struct {
	Reference string `json:"reference"`
	Name      string `json:"name"`
	SourceUrl string `json:"source_url"`
}

type ImageDownloadListener

type ImageDownloadListener struct {
	Vault      *vault.Vault
	HttpClient base.HttpClient
	Logger     *log.Logger
}

func (*ImageDownloadListener) Handle

func (l *ImageDownloadListener) Handle(notification *pq.Notification, m base.NodeManager) (int, error)

type ImageHandler

type ImageHandler struct {
	Vault  *vault.Vault
	Logger *log.Logger
}

func (*ImageHandler) GetDownloadData

func (h *ImageHandler) GetDownloadData(node *base.Node) *base.DownloadData

func (*ImageHandler) GetStruct

func (h *ImageHandler) GetStruct() (base.NodeData, base.NodeMeta)

func (*ImageHandler) PostInsert

func (h *ImageHandler) PostInsert(node *base.Node, m base.NodeManager) error

func (*ImageHandler) PostUpdate

func (h *ImageHandler) PostUpdate(node *base.Node, m base.NodeManager) error

func (*ImageHandler) PreInsert

func (h *ImageHandler) PreInsert(node *base.Node, m base.NodeManager) error

func (*ImageHandler) PreUpdate

func (h *ImageHandler) PreUpdate(node *base.Node, m base.NodeManager) error

func (*ImageHandler) StoreStream

func (h *ImageHandler) StoreStream(node *base.Node, r io.Reader) (int64, error)

type ImageMeta

type ImageMeta struct {
	Width        int      `json:"width"`
	Height       int      `json:"height"`
	Size         int      `json:"size"`
	ContentType  string   `json:"content_type"`
	Length       int      `json:"length"`
	Exif         ExifMeta `json:"exif"`
	Hash         string   `json:"hash"`
	SourceStatus int      `json:"source_status"`
	SourceError  string   `json:"source_error"`
}

type MediaViewHandler

type MediaViewHandler struct {
	Vault         *vault.Vault
	AllowedWidths []uint
	MaxWidth      uint
}

func (*MediaViewHandler) Execute

func (m *MediaViewHandler) Execute(node *base.Node, request *base.ViewRequest, response *base.ViewResponse) error

func (*MediaViewHandler) Support

func (m *MediaViewHandler) Support(node *base.Node, request *base.ViewRequest, response *base.ViewResponse) bool

type Youtube

type Youtube struct {
	Vid    string `json:"vid,omitempty"`
	Status int    `json:"status,omitempty"`
	Error  string `json:"error,omitempty"`
}

type YoutubeHandler

type YoutubeHandler struct {
}

func (*YoutubeHandler) GetStruct

func (h *YoutubeHandler) GetStruct() (base.NodeData, base.NodeMeta)

func (*YoutubeHandler) PostInsert

func (h *YoutubeHandler) PostInsert(node *base.Node, m base.NodeManager) error

func (*YoutubeHandler) PostUpdate

func (h *YoutubeHandler) PostUpdate(node *base.Node, m base.NodeManager) error

func (*YoutubeHandler) PreInsert

func (h *YoutubeHandler) PreInsert(node *base.Node, m base.NodeManager) error

func (*YoutubeHandler) PreUpdate

func (h *YoutubeHandler) PreUpdate(node *base.Node, m base.NodeManager) error

type YoutubeListener

type YoutubeListener struct {
	HttpClient base.HttpClient
}

func (*YoutubeListener) Handle

func (l *YoutubeListener) Handle(notification *pq.Notification, m base.NodeManager) (int, error)

type YoutubeMeta

type YoutubeMeta struct {
	Type            string `json:"type"`
	Html            string `json:"html"`
	Width           int    `json:"width"`
	Height          int    `json:"height"`
	Version         string `json:"version"`
	Title           string `json:"title"`
	ProviderName    string `json:"provider_name"`
	AuthorName      string `json:"author_name"`
	AuthorUrl       string `json:"author_url"`
	ProviderUrl     string `json:"provider_url"`
	ThumbnailUrl    string `json:"thumbnail_url"`
	ThumbnailWidth  int    `json:"thumbnail_width"`
	ThumbnailHeight int    `json:"thumbnail_height"`
}

Jump to

Keyboard shortcuts

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