config

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Config exports the config object
	Config *Configuration
	// Runtime flags/config
	Runtime      *RuntimeConfig
	RuntimeViper = viper.New()
	// ldflags (set by makefile or goreleaser)
	Build *BuildVars
	// State
	Pvr = make(map[string]*PvrInstance)
)

Functions

func Init

func Init(build *BuildVars) error

func InitRuntime

func InitRuntime() error

Types

type BuildVars

type BuildVars struct {
	// Version
	Version string
	// Timestamp
	Timestamp string
	// Git commit
	GitCommit string
}

BuildVars build details

type Configuration

type Configuration struct {
	Database DatabaseConfiguration
	Server   ServerConfig
	Pvr      []PvrConfig
	Trackers map[string]TrackerConfig
}

func (Configuration) ToJsonString

func (cfg Configuration) ToJsonString() (string, error)

type DatabaseConfiguration

type DatabaseConfiguration struct {
	MaxAgeHours int
}

type MessagePatternType

type MessagePatternType int
const (
	LinePattern MessagePatternType = iota + 1
	MultiLinePattern
)

type PvrConfig

type PvrConfig struct {
	Name    string
	Enabled bool
	URL     string
	ApiKey  string
	Timeout int
	Filters *PvrFilters
}

type PvrFilters

type PvrFilters struct {
	Ignores []string
	Accepts []string
	Delays  []string
}

type PvrInstance

type PvrInstance struct {
	Config             *PvrConfig
	IgnoresExpr        []*vm.Program
	AcceptsExpr        []*vm.Program
	DelaysExpr         []*vm.Program
	HasFileExpressions bool
}

func (*PvrInstance) ShouldAccept added in v1.5.0

func (p *PvrInstance) ShouldAccept(r *ReleaseInfo, log *logrus.Entry) (bool, error)

func (*PvrInstance) ShouldDelay added in v1.5.0

func (p *PvrInstance) ShouldDelay(r *ReleaseInfo, log *logrus.Entry) (*int64, error)

func (*PvrInstance) ShouldIgnore added in v1.5.0

func (p *PvrInstance) ShouldIgnore(r *ReleaseInfo, log *logrus.Entry) (bool, error)

type ReleaseInfo

type ReleaseInfo struct {
	TrackerName string
	ReleaseTime string
	TorrentName string
	TorrentURL  string
	TorrentId   string
	SizeString  string
	SizeBytes   int64
	Category    string
	Encoder     string
	Resolution  string
	Container   string
	Origin      string
	Source      string
	Tags        string
	Files       []string
	FreeLeech   bool
}

type RuntimeConfig

type RuntimeConfig struct {
	Verbose  int
	Config   string
	Log      string
	DB       string
	Trackers string
	Version  bool
}

type ServerConfig

type ServerConfig struct {
	Host      string
	Port      uint
	BaseURL   string
	ApiKey    string
	PublicURL string
	User      string
	Pass      string
}

type TrackerBencodeConfig

type TrackerBencodeConfig struct {
	Name bool
	Size bool
}

type TrackerConfig

type TrackerConfig struct {
	Enabled   bool
	ForceHTTP bool
	Bencode   *TrackerBencodeConfig
	Settings  map[string]string
	IRC       *TrackerIrcConfig
}

type TrackerIgnore

type TrackerIgnore struct {
	Rxp      *regexp.Regexp
	Expected bool
}

type TrackerInfo

type TrackerInfo struct {
	Name       string
	ShortName  *string
	LongName   string
	Settings   []string
	Servers    []string
	Channels   []string
	Announcers []string

	IgnoreLines       []TrackerIgnore
	LinePatterns      []TrackerPattern
	MultiLinePatterns []TrackerPattern

	LineMatchedRules *xmlquery.Node
}

type TrackerInstance

type TrackerInstance struct {
	Name   string
	Config *TrackerConfig
	Info   *TrackerInfo
	IRC    *irc.Connection
}

type TrackerIrcConfig

type TrackerIrcConfig struct {
	Nickname   string
	Channels   []string
	Announcers []string
	Commands   []string
	Host       *string
	Port       *string
	Password   string
	Sasl       TrackerIrcSaslConfig
	Verbose    bool
}

type TrackerIrcSaslConfig added in v1.7.0

type TrackerIrcSaslConfig struct {
	User string
	Pass string
}

type TrackerPattern

type TrackerPattern struct {
	PatternType MessagePatternType
	Rxp         *regexp.Regexp
	Vars        []string
	Optional    bool
}

Jump to

Keyboard shortcuts

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