internal

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2025 License: GPL-3.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDirNotFound              = errors.New("directory not found")
	ErrDirStatFailed            = errors.New("failed os.Stat")
	ErrDirWalkHandlerFailed     = errors.New("failed filepath.Walk handler")
	ErrFileRelativePathNotFound = errors.New("file relative path not found")
	ErrDirWalkFailed            = errors.New("failed filepath.Walk")
)
View Source
var (
	ErrPathMatch = errors.New("failed to match path")
	ErrIncludes  = errors.New("failed filter includes files")
	ErrExcludes  = errors.New("failed filter exclude files")
)
View Source
var (
	ErrParseChunkIndex = errors.New("failed parse chunk index")
	ErrFFMpeg          = errors.New("ffmpeg command failed")
	ErrCopy            = errors.New("failed to copy data")
)

Functions

func Bar

func Bar(length int, description string) *progressbar.ProgressBar

func GetExcludedFiles added in v1.1.0

func GetExcludedFiles(files []index.FileMeta, included, excluded []*regexp.Regexp) map[string]struct{}

func GetIncludedFiles added in v1.1.0

func GetIncludedFiles(files []index.FileMeta, included []*regexp.Regexp) map[string]struct{}

func PanicError

func PanicError(err error)

Types

type Config added in v1.1.0

type Config struct {
	Dir           string
	Port          int
	Streaming     []*regexp.Regexp
	IndexFileSave bool
	Process       ProcessConfig
}

func NewConfig added in v1.1.0

func NewConfig(raw RawConfig) Config

func (Config) Print added in v1.1.0

func (c Config) Print()

type CrawlerOS

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

func NewCrawlerOS

func NewCrawlerOS(path string) CrawlerOS

func (CrawlerOS) Scan

func (c CrawlerOS) Scan(exclude ...string) ([]index.FileMeta, error)

type CrawlerOSFile

type CrawlerOSFile struct {
	os.FileInfo
	// contains filtered or unexported fields
}

func (CrawlerOSFile) Path

func (cosf CrawlerOSFile) Path() string

func (CrawlerOSFile) RelativePath

func (cosf CrawlerOSFile) RelativePath() string

type MediaTypeConfig added in v1.1.0

type MediaTypeConfig struct {
	Process  bool
	MaxItems int64
}

func (MediaTypeConfig) Print added in v1.1.0

func (c MediaTypeConfig) Print(name string)

type PageData

type PageData struct {
	Items      []*index.Meta
	Path       []*index.Meta
	Zoom       string
	Sorts      []string
	ActiveSort string
	Search     string
}

type ProcessConfig added in v1.1.0

type ProcessConfig struct {
	Parallel    int
	Video       MediaTypeConfig
	VideoAccel  preview.VideoProcessingAccelType
	Timeout     time.Duration
	Image       MediaTypeConfig
	Includes    []*regexp.Regexp
	Excludes    []*regexp.Regexp
	MaxFileSize int64
}

func (ProcessConfig) Print added in v1.1.0

func (c ProcessConfig) Print()

type RawConfig added in v1.1.0

type RawConfig struct {
	Dir                  string
	Parallel             int
	Video                bool
	VideoProcessingAccel string
	Images               bool
	MaxImages            int64
	MaxVideos            int64
	Includes             string
	Excludes             string
	MaxFileSize          string
	Streaming            string
	MediaTimeout         string
	IndexFileSave        bool
	Port                 int
}

func DefaultRawConfig added in v1.1.0

func DefaultRawConfig() RawConfig

type RawFile

type RawFile interface {
	Name() string
	ModTime() time.Time
	IsDir() bool
	Size() int64
}

type Server

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

func NewServer

func NewServer(ctx context.Context, opts ...ServerOption) *Server

type ServerOption

type ServerOption func(*Server)

func WithDebug

func WithDebug(debug bool) ServerOption

func WithDry added in v1.1.0

func WithDry() ServerOption

func WithPWD added in v1.1.0

func WithPWD(dir string) ServerOption

func WithPort

func WithPort(port int) ServerOption

func WithSource

func WithSource(source source) ServerOption

func WithStreaming added in v1.1.0

func WithStreaming(files map[string]struct{}) ServerOption

Jump to

Keyboard shortcuts

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