app

package
v1.1.12 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2020 License: MIT Imports: 32 Imported by: 0

Documentation

Overview

Package app manages main application server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Config    *Config
	Library   *media.Library
	Store     Store
	Watcher   *fsnotify.Watcher
	Templates *templateStore
	Feed      []byte
	Listener  net.Listener
	Router    *mux.Router
}

App represents main application.

func NewApp

func NewApp(cfg *Config) (*App, error)

NewApp returns a new instance of App from Config.

func (*App) Run

func (a *App) Run() error

Run imports the library and starts server.

type BitcaskStore

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

BitcaskStore ...

func (*BitcaskStore) Close

func (s *BitcaskStore) Close() error

Close ...

func (*BitcaskStore) GetViews

func (s *BitcaskStore) GetViews(id string) (int64, error)

GetViews ...

func (*BitcaskStore) GetViews_

func (s *BitcaskStore) GetViews_(collection, id string) (int64, error)

GetViews_ ...

func (*BitcaskStore) IncView_

func (s *BitcaskStore) IncView_(collection, id string) error

IncView_ ...

func (*BitcaskStore) IncViews

func (s *BitcaskStore) IncViews(id string) error

IncViews ...

func (*BitcaskStore) Migrate

func (s *BitcaskStore) Migrate(collection, id string) error

Migrate ...

type Config

type Config struct {
	Library     []*PathConfig      `json:"library"`
	Server      *ServerConfig      `json:"server"`
	Thumbnailer *ThumbnailerConfig `json:"thumbnailer"`
	Transcoder  *TranscoderConfig  `json:"transcoder"`
	Feed        *FeedConfig        `json:"feed"`
}

Config settings for main App.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns Config initialized with default values.

func (*Config) ReadFile

func (c *Config) ReadFile(path string) error

ReadFile reads a JSON file into Config.

type FeedConfig

type FeedConfig struct {
	ExternalURL string `json:"external_url"`
	Title       string `json:"title"`
	Link        string `json:"link"`
	Description string `json:"description"`
	Author      struct {
		Name  string `json:"name"`
		Email string `json:"email"`
	} `json:"author"`
	Copyright string `json:"copyright"`
}

FeedConfig settings for App Feed.

type PathConfig

type PathConfig struct {
	Path   string `json:"path"`
	Prefix string `json:"prefix"`
}

PathConfig settings for media library path.

type ServerConfig

type ServerConfig struct {
	Host          string `json:"host"`
	Port          int    `json:"port"`
	StorePath     string `json:"store_path"`
	UploadPath    string `json:"upload_path"`
	MaxUploadSize int64  `json:"max_upload_size"`
}

ServerConfig settings for App Server.

type Sizes

type Sizes map[string]string

Sizes a map of ffmpeg -s option to suffix. e.g: hd720 -> #720p

type Store

type Store interface {
	Close() error
	Migrate(collection, id string) error
	GetViews_(collection, id string) (int64, error)
	IncView_(collection, id string) error
	GetViews(id string) (int64, error)
	IncViews(id string) error
}

Store ...

func NewBitcaskStore

func NewBitcaskStore(path string, options ...bitcask.Option) (Store, error)

NewBitcaskStore ...

type ThumbnailerConfig

type ThumbnailerConfig struct {
	Timeout int `json:"timeout"`
}

ThumbnailerConfig settings for Transcoder

type TranscoderConfig

type TranscoderConfig struct {
	Timeout int   `json:"timeout"`
	Sizes   Sizes `json:"sizes"`
}

TranscoderConfig settings for Transcoder

Jump to

Keyboard shortcuts

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