configuration

package
v0.0.0-...-2b5c1d7 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingDetailerNames  = errors.New("configuration: missing detailer names")
	ErrMissingTorrenterNames = errors.New("configuration: missing torrenter names")
)

Custom errors

View Source
var (
	ErrMissingModuleParams = errors.New("configuration: missing module params")
)

Custom errors

Functions

This section is empty.

Types

type Config

type Config struct {
	Logger            *logrus.Logger
	Watcher           WatcherConfig
	Downloader        DownloaderConfig
	DownloadManager   DownloadManagerConfig
	HTTPServer        HTTPServer
	Wishlist          polochon.WishlistConfig
	Movie             polochon.MovieConfig
	Show              polochon.ShowConfig
	File              polochon.FileConfig
	Library           LibraryConfig
	Notifiers         []polochon.Notifier
	SubtitleLanguages []polochon.Language
}

Config represents the configuration for polochon

func LoadConfig

func LoadConfig(r io.Reader) (*Config, error)

LoadConfig loads the configuration from a reader

func LoadConfigFile

func LoadConfigFile(path string) (*Config, error)

LoadConfigFile reads a file from a path and returns a config

func (*Config) ModulesStatus

func (c *Config) ModulesStatus() ModulesStatuses

ModulesStatus gives the status of the modules configured

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the Unmarshaler interface

type DownloadManagerConfig

type DownloadManagerConfig struct {
	Enabled bool          `yaml:"enabled"`
	Dir     string        `yaml:"dir"`
	Timer   time.Duration `yaml:"timer"`
	Ratio   float32       `yaml:"ratio"`
}

DownloadManagerConfig represents the configuration for the download manager

type DownloaderConfig

type DownloaderConfig struct {
	Enabled         bool
	LaunchAtStartup bool
	Schedule        cron.Schedule
	Client          polochon.Downloader
}

DownloaderConfig represents the configuration for the downloader

type HTTPServer

type HTTPServer struct {
	// TODO: enable => enabled
	Enable            bool     `yaml:"enable"`
	Port              int      `yaml:"port"`
	Host              string   `yaml:"host"`
	ServeFiles        bool     `yaml:"serve_files"`
	BasicAuth         bool     `yaml:"basic_auth"`
	BasicAuthUser     string   `yaml:"basic_auth_user"`
	BasicAuthPassword string   `yaml:"basic_auth_password"`
	LogExcludePaths   []string `yaml:"log_exclude_paths"`
}

HTTPServer represents the configuration for the HTTP Server

type LibraryConfig

type LibraryConfig struct {
	MovieDir string
	ShowDir  string
}

LibraryConfig represents configuration for the library

type Logger

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

Logger represents a logger

func (*Logger) UnmarshalYAML

func (l *Logger) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the Unmarshaler interface

type ModuleFetcher

type ModuleFetcher interface {
	GetDetailers() []polochon.Detailer
	GetTorrenters() []polochon.Torrenter
	GetSearchers() []polochon.Searcher
	GetExplorers() []polochon.Explorer
	GetSubtitlers() []polochon.Subtitler
}

ModuleFetcher is an interface which allows to get torrenters and detailers ...

type ModuleLoader

type ModuleLoader struct {
	TorrenterNames  []string `yaml:"torrenters"`
	DetailerNames   []string `yaml:"detailers"`
	SubtitlerNames  []string `yaml:"subtitlers"`
	SearcherNames   []string `yaml:"searchers"`
	ExplorerNames   []string `yaml:"explorers"`
	NotifierNames   []string `yaml:"notifiers"`
	WishlisterNames []string `yaml:"wishlisters"`
	GuesserNames    []string `yaml:"guessers"`
	CalendarName    string   `yaml:"calendar"`
	FsNotifierName  string   `yaml:"fsnotifier"`
	DownloaderName  string   `yaml:"client"` // TODO: fix the name
	// contains filtered or unexported fields
}

ModuleLoader is an helper to be embeded in the configuration structure. It gets the module names from yaml and loads the module using the modules parameters.

type ModuleStatus

type ModuleStatus struct {
	Name   string                `json:"name"`
	Status polochon.ModuleStatus `json:"status"`
	Error  string                `json:"error"`
}

ModuleStatus represent the status of a module

type ModulesParams

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

ModulesParams holds the module params in raw yaml

func (*ModulesParams) UnmarshalYAML

func (mp *ModulesParams) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the Unmarshaler interface

type ModulesStatuses

type ModulesStatuses map[string]map[string][]*ModuleStatus

ModulesStatuses represent the status of all the modules

type WatcherConfig

type WatcherConfig struct {
	Dir        string
	FsNotifier polochon.FsNotifier
}

WatcherConfig represents the configuration for the detailers

Jump to

Keyboard shortcuts

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