unpackerr

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 70 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	WAITING          = extract.WAITING
	QUEUED           = extract.QUEUED
	EXTRACTING       = extract.EXTRACTING
	EXTRACTFAILED    = extract.EXTRACTFAILED
	EXTRACTED        = extract.EXTRACTED
	IMPORTED         = extract.IMPORTED
	DELETING         = extract.DELETING
	DELETEFAILED     = extract.DELETEFAILED
	DELETED          = extract.DELETED
	EXTRACTEDNOTHING = extract.EXTRACTEDNOTHING
)

Extract Statuses.

View Source
const (
	PermReadSystemStats    = "system:stats:read"
	PermReadSystemInfo     = "system:info:read"
	PermReadSystemQueue    = "system:queue:read"
	PermWriteSystemQueue   = "system:queue:write"
	PermReadSystemHistory  = "system:history:read"
	PermWriteSystemHistory = "system:history:write"
	PermReadSystemMetrics  = "system:metrics:read"
	PermReadSystemHeaders  = "system:headers:read"
	PermReadSystemBrowse   = "system:browse:read"
	PermWriteSystemBrowse  = "system:browse:write"
	PermReadSystemLogs     = "system:logs:read"
	PermAll                = "*"
	RoleAdmin              = "admin"
)

Permission names are area:resource:verb so later verbs (execute, …) stay on the same resource. Built-in role admin grants all of them.

View Source
const DefaultQueuePageSize = 2000

DefaultQueuePageSize is how many queue items we request from each Starr app. If you have more than this many items queued.. oof. As the queue goes away, more things should get picked up.

View Source
const (
	FolderString = "Folder"
)

These are the names used to identify each app.

Variables

View Source
var (
	ErrInvalidURL  = errors.New("provided application URL is invalid")
	ErrInvalidKey  = fmt.Errorf("provided application API Key is invalid, must be at least %d characters", apiKeyMinLength)
	ErrInvalidName = errors.New("instance name must be printable and cannot contain quotes, braces, or angle brackets")
)

Application validation errors.

View Source
var (
	// ErrInvalidRemnantAction is returned when remnant_action is not rename, delete, or off.
	ErrInvalidRemnantAction = errors.New("invalid remnant_action")
)

Errors produced by this file.

Functions

func AllPermissions added in v1.0.0

func AllPermissions() []string

AllPermissions is every known permission, including per-section config ones.

func DeriveKDF added in v1.0.0

func DeriveKDF(username, password string) string

DeriveKDF is PBKDF2-HMAC-SHA-256(password, salt="unpackerr:"+username, 210000, 32 bytes) as hex.

func GenerateAPIKey added in v1.0.0

func GenerateAPIKey() (string, error)

GenerateAPIKey returns a random 64-character URL-safe API key.

func GeneratePassword added in v1.0.0

func GeneratePassword() (string, error)

GeneratePassword returns a random URL-safe temporary password.

func KnownPermission added in v1.0.0

func KnownPermission(name string) bool

func KnownSection added in v1.0.0

func KnownSection(name ConfigSection) bool

func PermReadConfig added in v1.0.0

func PermReadConfig(section ConfigSection) string

func PermWriteConfig added in v1.0.0

func PermWriteConfig(section ConfigSection) string

func Start

func Start() error

Start runs the app.

Types

type APIKey added in v1.0.0

type APIKey struct {
	Name  string   `json:"name"  toml:"name"  xml:"name"  yaml:"name"`
	Key   string   `json:"key"   toml:"key"   xml:"key"   yaml:"key"`
	Roles []string `json:"roles" toml:"roles" xml:"roles" yaml:"roles"`
}

APIKey is a named secret assigned one or more roles.

type AllowedIPs added in v0.12.0

type AllowedIPs struct {
	Input []string
	Nets  []*net.IPNet
}

AllowedIPs determines who can set x-forwarded-for.

func MakeIPs added in v0.12.0

func MakeIPs(upstreams []string) AllowedIPs

MakeIPs turns a list of CIDR strings (or plain IPs) into a list of net.IPNet. This "allowed" list is later used to check incoming IPs from web requests.

func (AllowedIPs) Contains added in v0.12.0

func (n AllowedIPs) Contains(ipAddr string) bool

Contains returns true if an IP is allowed.

func (AllowedIPs) String added in v0.12.0

func (n AllowedIPs) String() string

String turns a list of allowedIPs into a printable masterpiece.

type AuthType added in v1.0.0

type AuthType int

AuthType is the configured web UI authentication mode.

const (
	AuthPassword AuthType = iota
	AuthHeader
	AuthNone
)

func (AuthType) String added in v1.0.0

func (t AuthType) String() string

type BrowseDir added in v1.0.0

type BrowseDir struct {
	Sep   string   `json:"sep"`
	Path  string   `json:"path"`
	Mom   string   `json:"mom"`
	Dirs  []string `json:"dirs"`
	Files []string `json:"files"`
	Error string   `json:"error"`
}

BrowseDir is the JSON body for GET/POST /api/browse.

type BufferStat added in v1.0.0

type BufferStat struct {
	Len uint `json:"len"`
	Cap uint `json:"cap"`
}

BufferStat is occupancy and capacity of one internal channel.

type Config

type Config struct {
	Debug         bool                       `json:"debug"             toml:"debug"          xml:"debug"          yaml:"debug"`
	Quiet         bool                       `json:"quiet"             toml:"quiet"          xml:"quiet"          yaml:"quiet"`
	Activity      bool                       `json:"activity"          toml:"activity"       xml:"activity"       yaml:"activity"`
	Parallel      uint                       `json:"parallel"          toml:"parallel"       xml:"parallel"       yaml:"parallel"`
	ErrorStdErr   bool                       `json:"errorStderr"       toml:"error_stderr"   xml:"error_stderr"   yaml:"errorStderr"`
	LogFile       string                     `json:"logFile"           toml:"log_file"       xml:"log_file"       yaml:"logFile"`
	LogFiles      int                        `json:"logFiles"          toml:"log_files"      xml:"log_files"      yaml:"logFiles"`
	LogFileMb     int                        `json:"logFileMb"         toml:"log_file_mb"    xml:"log_file_mb"    yaml:"logFileMb"`
	LogFileMode   string                     `json:"logFileMode"       toml:"log_file_mode"  xml:"log_file_mode"  yaml:"logFileMode"`
	MaxRetries    uint                       `json:"maxRetries"        toml:"max_retries"    xml:"max_retries"    yaml:"maxRetries"`
	RemnantAction string                     `json:"remnantAction"     toml:"remnant_action" xml:"remnant_action" yaml:"remnantAction"`
	FileMode      string                     `json:"fileMode"          toml:"file_mode"      xml:"file_mode"      yaml:"fileMode"`
	DirMode       string                     `json:"dirMode"           toml:"dir_mode"       xml:"dir_mode"       yaml:"dirMode"`
	LogQueues     cnfg.Duration              `json:"logQueues"         toml:"log_queues"     xml:"log_queues"     yaml:"logQueues"`
	Interval      cnfg.Duration              `json:"interval"          toml:"interval"       xml:"interval"       yaml:"interval"`
	Timeout       cnfg.Duration              `json:"timeout"           toml:"timeout"        xml:"timeout"        yaml:"timeout"`
	DeleteDelay   cnfg.Duration              `json:"deleteDelay"       toml:"delete_delay"   xml:"delete_delay"   yaml:"deleteDelay"`
	StartDelay    cnfg.Duration              `json:"startDelay"        toml:"start_delay"    xml:"start_delay"    yaml:"startDelay"`
	RetryDelay    cnfg.Duration              `json:"retryDelay"        toml:"retry_delay"    xml:"retry_delay"    yaml:"retryDelay"`
	Progress      cnfg.Duration              `json:"progress"          toml:"progress"       xml:"progress"       yaml:"progress"`
	KeepHistory   uint                       `json:"keepHistory"       toml:"keep_history"   xml:"keep_history"   yaml:"keepHistory"`
	Passwords     StringSlice                `json:"passwords"         toml:"passwords"      xml:"password"       yaml:"passwords"`
	Webserver     *WebServer                 `json:"webserver"         toml:"webserver"      xml:"webserver"      yaml:"webserver"`
	Lidarr        InstanceMap[LidarrConfig]  `json:"lidarr,omitempty"  toml:"lidarr"         xml:"lidarr"         yaml:"lidarr,omitempty"`
	Radarr        InstanceMap[RadarrConfig]  `json:"radarr,omitempty"  toml:"radarr"         xml:"radarr"         yaml:"radarr,omitempty"`
	Readarr       InstanceMap[ReadarrConfig] `json:"readarr,omitempty" toml:"readarr"        xml:"readarr"        yaml:"readarr,omitempty"`
	Sonarr        InstanceMap[SonarrConfig]  `json:"sonarr,omitempty"  toml:"sonarr"         xml:"sonarr"         yaml:"sonarr,omitempty"`
	Folders       InstanceMap[FolderConfig]  `json:"folder,omitempty"  toml:"folder"         xml:"folder"         yaml:"folder,omitempty"`
	Webhook       InstanceMap[WebhookConfig] `json:"webhook,omitempty" toml:"webhook"        xml:"webhook"        yaml:"webhook,omitempty"`
	Cmdhook       InstanceMap[WebhookConfig] `json:"cmdhook,omitempty" toml:"cmdhook"        xml:"cmdhook"        yaml:"cmdhook,omitempty"`
	Hooks         HooksConfig                `json:"hooks"             toml:"hooks"          xml:"hooks"          yaml:"hooks"`
	Folder        FoldersConfig              `json:"folders"           toml:"folders"        xml:"folders"        yaml:"folders"` // undocumented.
}

Config defines the configuration data used to start the application.

type ConfigSection added in v1.0.0

type ConfigSection string

ConfigSection is a per-section config API resource name.

const (
	SectionGeneral   ConfigSection = "general"
	SectionWebserver ConfigSection = "webserver"
	SectionSonarr    ConfigSection = "sonarr"
	SectionRadarr    ConfigSection = "radarr"
	SectionLidarr    ConfigSection = "lidarr"
	SectionReadarr   ConfigSection = "readarr"
	SectionFolders   ConfigSection = "folders"
	SectionHooks     ConfigSection = "hooks"
	SectionWebhooks  ConfigSection = "webhooks"
	SectionCmdhooks  ConfigSection = "cmdhooks"
)

func ConfigSections added in v1.0.0

func ConfigSections() []ConfigSection

ConfigSections is the GET/PUT /api/config/{section} list.

type CryptPass added in v1.0.0

type CryptPass string

CryptPass stores a UI password the same way Notifiarr does: !!cryptd!!, user:pass, webauth:Header, noauth.

func (CryptPass) Header added in v1.0.0

func (p CryptPass) Header() string

func (CryptPass) IsCrypted added in v1.0.0

func (p CryptPass) IsCrypted() bool

func (CryptPass) Noauth added in v1.0.0

func (p CryptPass) Noauth() bool

func (*CryptPass) Set added in v1.0.0

func (p *CryptPass) Set(username, secret string) error

Set stores header/noauth as-is, or bcrypts the KDF hex as !!cryptd!!user:$2a$...

func (*CryptPass) SetPlain added in v1.0.0

func (p *CryptPass) SetPlain(username, password string) error

SetPlain PBKDF2-hashes a plaintext password then bcrypts the KDF hex.

func (CryptPass) Type added in v1.0.0

func (p CryptPass) Type() AuthType

func (CryptPass) Username added in v1.0.0

func (p CryptPass) Username() string

func (CryptPass) Val added in v1.0.0

func (p CryptPass) Val() string

func (CryptPass) Valid added in v1.0.0

func (p CryptPass) Valid(username, kdfHex string) bool

func (CryptPass) ValidPlain added in v1.0.0

func (p CryptPass) ValidPlain(username, password string) bool

func (CryptPass) Webauth added in v1.0.0

func (p CryptPass) Webauth() bool

type Extract

type Extract = extract.Extract

Type aliases keep the daemon and tests on the historical names while the types themselves live in pkg/extract, pkg/hooks, and pkg/folders.

type ExtractProgress added in v0.15.0

type ExtractProgress = extract.Progress

Type aliases keep the daemon and tests on the historical names while the types themselves live in pkg/extract, pkg/hooks, and pkg/folders.

type ExtractStatus

type ExtractStatus = extract.Status

Type aliases keep the daemon and tests on the historical names while the types themselves live in pkg/extract, pkg/hooks, and pkg/folders.

type ExtractStatuses added in v0.11.2

type ExtractStatuses = hooks.Statuses

Type aliases keep the daemon and tests on the historical names while the types themselves live in pkg/extract, pkg/hooks, and pkg/folders.

type Flags

type Flags struct {
	ConfigFile string
	EnvPrefix  string
	// contains filtered or unexported fields
}

Flags are our CLI input flags.

func (*Flags) ConfigFileWithAge added in v0.14.0

func (f *Flags) ConfigFileWithAge() string

type Folder

type Folder = folders.Folder

Type aliases keep the daemon and tests on the historical names while the types themselves live in pkg/extract, pkg/hooks, and pkg/folders.

type FolderConfig

type FolderConfig = folders.FolderConfig

Type aliases keep the daemon and tests on the historical names while the types themselves live in pkg/extract, pkg/hooks, and pkg/folders.

type Folders

type Folders = folders.Folders

Type aliases keep the daemon and tests on the historical names while the types themselves live in pkg/extract, pkg/hooks, and pkg/folders.

type FoldersConfig added in v0.14.0

type FoldersConfig = folders.WatchConfig

Type aliases keep the daemon and tests on the historical names while the types themselves live in pkg/extract, pkg/hooks, and pkg/folders.

type History

type History struct {
	Finished uint
	Retries  uint
	Map      map[string]*Extract
	// contains filtered or unexported fields
}

History holds the history of extracted items. mu guards Map, Finished, Retries, forgotten, per-item Status/Updated, Note, HookFail, HookMessages, XProg progress, and the Starr poll snapshot (Queue, lastQueued, lastRetrieved, lastPolled, lastPollErr) so HTTP stats, queue snapshots, and Prometheus Collect cannot race poll workers. It is not reentrant; do not lock inside a caller that already holds it.

type HistoryRecord added in v1.0.0

type HistoryRecord struct {
	ID             string              `json:"id"`
	App            string              `json:"app"`
	Kind           string              `json:"kind,omitempty"` // Starr dialect or Folder; App is the instance label.
	URL            string              `json:"url,omitempty"`
	Path           string              `json:"path"`
	OutputPath     string              `json:"outputPath,omitempty"`
	Status         ExtractStatus       `json:"status"`
	Retries        uint                `json:"retries"`
	HookFail       uint                `json:"hookFail,omitempty"`
	HookMessages   map[string]string   `json:"hookMessages,omitempty"`
	Started        time.Time           `json:"started"`
	Updated        time.Time           `json:"updated"`
	Finished       time.Time           `json:"finished,omitzero"`
	Archives       int                 `json:"archives,omitempty"`
	Files          int                 `json:"files,omitempty"`
	Bytes          uint64              `json:"bytes,omitempty"`
	Ratio          float64             `json:"ratio,omitempty"`
	Elapsed        string              `json:"elapsed,omitempty"`
	Error          string              `json:"error,omitempty"`
	Progress       string              `json:"progress,omitempty"`
	DeleteOrig     bool                `json:"deleteOrig,omitempty"`
	DeleteDelay    string              `json:"deleteDelay,omitempty"` // Go duration, e.g. 5m0s
	Syncthing      bool                `json:"syncthing,omitempty"`
	SplitFlac      bool                `json:"splitFlac,omitempty"`
	APEFormat      xtractr.AudioFormat `json:"apeFormat,omitempty"`
	APECompression int                 `json:"apeCompression,omitempty"`
	MaxBytes       uint64              `json:"maxBytes,omitempty"`
	NoRetry        bool                `json:"noRetry,omitempty"`
	NewFiles       []string            `json:"newFiles,omitempty"`
	OrigFiles      []string            `json:"origFiles,omitempty"`  // Archive paths; folder delete_orig after a restart.
	ExtraFiles     []string            `json:"extraFiles,omitempty"` // Nested extras; display + restore Resp.Extras.
	PreFiles       []string            `json:"preFiles,omitempty"`
	Forgotten      bool                `json:"forgotten,omitempty"`
	IDs            map[string]any      `json:"ids,omitempty"` // Starr hook metadata (title, downloadId, …).
	Event          string              `json:"event,omitempty"`
	Queue          int                 `json:"queue,omitempty"`  // xtractr waiting count when this extract started.
	Output         string              `json:"output,omitempty"` // xtractr dest folder.
}

HistoryRecord is one JSONL row (history API + restart resume).

type HookTitles added in v1.0.0

type HookTitles struct {
	Waiting          string `json:"waiting"          toml:"waiting,omitempty"          xml:"waiting"          yaml:"waiting"`
	Queued           string `json:"queued"           toml:"queued,omitempty"           xml:"queued"           yaml:"queued"`
	Extracting       string `json:"extracting"       toml:"extracting,omitempty"       xml:"extracting"       yaml:"extracting"`
	ExtractFailed    string `json:"extractfailed"    toml:"extractfailed,omitempty"    xml:"extractfailed"    yaml:"extractfailed"`
	Extracted        string `json:"extracted"        toml:"extracted,omitempty"        xml:"extracted"        yaml:"extracted"`
	Imported         string `json:"imported"         toml:"imported,omitempty"         xml:"imported"         yaml:"imported"`
	Deleting         string `json:"deleting"         toml:"deleting,omitempty"         xml:"deleting"         yaml:"deleting"`
	DeleteFailed     string `json:"deletefailed"     toml:"deletefailed,omitempty"     xml:"deletefailed"     yaml:"deletefailed"`
	Deleted          string `json:"deleted"          toml:"deleted,omitempty"          xml:"deleted"          yaml:"deleted"`
	ExtractedNothing string `json:"extractednothing" toml:"extractednothing,omitempty" xml:"extractednothing" yaml:"extractednothing"`
}

HookTitles is the known extract-event title overrides. Empty keeps Status.Desc().

type HooksConfig added in v1.0.0

type HooksConfig struct {
	CustomIDs map[string]string `json:"customIDs" toml:"custom_ids,omitempty" xml:"custom_ids" yaml:"customIDs"`
	Titles    HookTitles        `json:"titles"    toml:"titles,omitempty"     xml:"titles"     yaml:"titles"`
}

HooksConfig is the global hooks table: extra payload IDs and per-event titles.

type InstanceMap added in v1.0.0

type InstanceMap[T any] map[string]*T

InstanceMap is a slug-keyed instance list. JSON and TOML still accept the 0.x array form ([sonarr] / [{…}]) and convert rows to keys "0", "1", ….

func (*InstanceMap[T]) UnmarshalJSON added in v1.0.0

func (m *InstanceMap[T]) UnmarshalJSON(raw []byte) error

func (*InstanceMap[T]) UnmarshalTOML added in v1.0.0

func (m *InstanceMap[T]) UnmarshalTOML(data any) error

type LidarrConfig

type LidarrConfig struct {
	StarrConfig
	SplitFlac      bool          `json:"split_flac"      toml:"split_flac"      xml:"split_flac"      yaml:"split_flac"`
	APEFormat      string        `json:"ape_format"      toml:"ape_format"      xml:"ape_format"      yaml:"ape_format"`
	APECompression int           `json:"ape_compression" toml:"ape_compression" xml:"ape_compression" yaml:"ape_compression"` //nolint:lll
	Queue          *lidarr.Queue `json:"-"               toml:"-"               xml:"-"               yaml:"-"`
	*lidarr.Lidarr `json:"-"               toml:"-"               xml:"-"               yaml:"-"`
}

LidarrConfig represents the input data for a Lidarr server.

type LogFileInfo added in v1.0.0

type LogFileInfo struct {
	ID   string    `json:"id"`
	Name string    `json:"name"`
	Path string    `json:"path"`
	Size int64     `json:"size"`
	Time time.Time `json:"time"`
	Mode string    `json:"mode"`
	Used bool      `json:"used"`
	User string    `json:"user"`
}

LogFileInfo is one current or rotated log file.

type LogFileInfos added in v1.0.0

type LogFileInfos struct {
	Dirs []string       `json:"dirs"`
	Size int64          `json:"size"`
	List []*LogFileInfo `json:"list"`
}

LogFileInfos holds metadata about files in the log directories.

func GetFilePaths added in v1.0.0

func GetFilePaths(files ...string) *LogFileInfos

GetFilePaths returns files in the same folder with the same extension as the given paths.

func (*LogFileInfos) Len added in v1.0.0

func (l *LogFileInfos) Len() int

func (*LogFileInfos) Less added in v1.0.0

func (l *LogFileInfos) Less(i, j int) bool

func (*LogFileInfos) Swap added in v1.0.0

func (l *LogFileInfos) Swap(i, j int)

type Logger

type Logger struct {
	HTTP  *log.Logger
	Info  *log.Logger
	Error *log.Logger
	Debug *log.Logger
	// contains filtered or unexported fields
}

Logger provides a struct we can pass into other packages.

func (*Logger) Debugf

func (l *Logger) Debugf(msg string, v ...any)

Debugf writes Debug log lines... to stdout and/or a file.

func (*Logger) Errorf added in v0.12.0

func (l *Logger) Errorf(msg string, v ...any)

Errorf writes log errors... to stdout and/or a file.

func (*Logger) Printf

func (l *Logger) Printf(msg string, v ...any)

Printf writes log lines... to stdout and/or a file.

type MetricsCollector added in v0.12.0

type MetricsCollector struct {
	*Unpackerr
	// contains filtered or unexported fields
}

MetricsCollector is used to plug into a custom Prometheus metrics collector.

func (*MetricsCollector) Collect added in v0.12.0

func (c *MetricsCollector) Collect(metrics chan<- prometheus.Metric)

Collect satisfies the Prometheus custom metrics collector.

func (*MetricsCollector) Describe added in v0.12.0

func (c *MetricsCollector) Describe(ch chan<- *prometheus.Desc)

Describe satisfies the Prometheus custom metrics collector.

type QueueItem added in v1.0.0

type QueueItem struct {
	ID          string         `json:"id"`
	App         string         `json:"app"`
	URL         string         `json:"url,omitempty"`
	Path        string         `json:"path"`
	OutputPath  string         `json:"outputPath,omitempty"`
	Status      ExtractStatus  `json:"status"`
	Retries     uint           `json:"retries"`
	HookFail    uint           `json:"hookFail,omitempty"`
	Updated     time.Time      `json:"updated"`
	Progress    string         `json:"progress,omitempty"`
	Error       string         `json:"error,omitempty"`
	Percent     float64        `json:"percent,omitempty"`
	Wrote       uint64         `json:"wrote,omitempty"`
	Total       uint64         `json:"total,omitempty"`
	Read        uint64         `json:"read,omitempty"`
	Compressed  uint64         `json:"compressed,omitempty"`
	Files       int            `json:"files,omitempty"`
	Count       int            `json:"count,omitempty"`
	Archives    int            `json:"archives,omitempty"`
	Extracted   int            `json:"extracted,omitempty"`
	Archive     string         `json:"archive,omitempty"`
	SpeedBps    uint64         `json:"speedBps,omitempty"`    // last sample interval
	AvgSpeedBps uint64         `json:"avgSpeedBps,omitempty"` // bytes so far / extract duration
	ETA         time.Time      `json:"eta,omitzero"`
	Due         time.Time      `json:"due,omitzero"`
	DueKind     string         `json:"dueKind,omitempty"` // start, retry, cleanup, history
	Note        string         `json:"note,omitempty"`
	Event       string         `json:"event,omitempty"` // folders: fsnotify, polling; later manual
	Started     time.Time      `json:"started,omitzero"`
	Elapsed     string         `json:"elapsed,omitempty"`
	Bytes       uint64         `json:"bytes,omitempty"`
	Ratio       float64        `json:"ratio,omitempty"`
	Queue       int            `json:"queue,omitempty"`  // xtractr waiting count when this extract started.
	Output      string         `json:"output,omitempty"` // xtractr dest folder.
	Kind        string         `json:"kind,omitempty"`
	IDs         map[string]any `json:"ids,omitempty"`
	NewFiles    []string       `json:"newFiles,omitempty"`  // GET /api/queue/item only; omitted from progress.
	OrigFiles   []string       `json:"origFiles,omitempty"` // GET /api/queue/item only; omitted from progress.
}

QueueItem is a live in-flight extract for GET /api/queue.

type RadarrConfig

type RadarrConfig struct {
	StarrConfig
	Queue          *radarr.Queue `json:"-" toml:"-" xml:"-" yaml:"-"`
	*radarr.Radarr `json:"-" toml:"-" xml:"-" yaml:"-"`
}

RadarrConfig represents the input data for a Radarr server.

type ReadarrConfig

type ReadarrConfig struct {
	StarrConfig
	Queue            *readarr.Queue `json:"-" toml:"-" xml:"-" yaml:"-"`
	*readarr.Readarr `json:"-" toml:"-" xml:"-" yaml:"-"`
}

ReadarrConfig represents the input data for a Readarr server.

type Role added in v1.0.0

type Role struct {
	Permissions []string `json:"permissions" toml:"permissions" xml:"permissions" yaml:"permissions"`
}

Role is a named permission set. Built-in admin is not stored here.

type SonarrConfig

type SonarrConfig struct {
	StarrConfig
	Queue          *sonarr.Queue `json:"-" toml:"-" xml:"-" yaml:"-"`
	*sonarr.Sonarr `json:"-" toml:"-" xml:"-" yaml:"-"`
}

SonarrConfig represents the input data for a Sonarr server.

type StarrConfig

type StarrConfig struct {
	starr.Config
	Name        string        `json:"name"         toml:"name"         xml:"name"         yaml:"name"`
	Path        string        `json:"path"         toml:"path"         xml:"path"         yaml:"path"`
	Paths       StringSlice   `json:"paths"        toml:"paths"        xml:"paths"        yaml:"paths"`
	Protocols   string        `json:"protocols"    toml:"protocols"    xml:"protocols"    yaml:"protocols"`
	DeleteOrig  bool          `json:"delete_orig"  toml:"delete_orig"  xml:"delete_orig"  yaml:"delete_orig"`
	DeleteDelay cnfg.Duration `json:"delete_delay" toml:"delete_delay" xml:"delete_delay" yaml:"delete_delay"`
	Syncthing   bool          `json:"syncthing"    toml:"syncthing"    xml:"syncthing"    yaml:"syncthing"`
	ValidSSL    bool          `json:"valid_ssl"    toml:"valid_ssl"    xml:"valid_ssl"    yaml:"valid_ssl"`
	Timeout     cnfg.Duration `json:"timeout"      toml:"timeout"      xml:"timeout"      yaml:"timeout"`
	// MaxBytes overrides the app default (Sonarr 20GB, Radarr 75GB, Lidarr 4GB, Readarr 1GB).
	// Empty uses that default. `0` or `0B` is unlimited.
	MaxBytes string `json:"maxBytes" toml:"max_bytes" xml:"max_bytes" yaml:"maxBytes"`
	// contains filtered or unexported fields
}

StarrConfig is the shared config items for all starr apps.

func (*StarrConfig) Label added in v1.0.0

func (c *StarrConfig) Label(app starr.App) string

Label is the human-facing instance name, or app when Name is empty.

type StarrQueueStat added in v1.0.0

type StarrQueueStat struct {
	App         string    `json:"app"`
	Name        string    `json:"name"`
	URL         string    `json:"url,omitempty"`
	Queued      int       `json:"queued"`
	Retrieved   int       `json:"retrieved"`
	Complete    int       `json:"complete"`
	Match       int       `json:"match"`
	Issues      int       `json:"issues"`
	Downloading int       `json:"downloading"`
	UpdatedAt   time.Time `json:"updatedAt,omitzero"`
	Error       string    `json:"error,omitempty"`
}

StarrQueueStat is one Starr instance's last activity-queue poll.

type Stats added in v0.12.0

type Stats struct {
	Waiting      uint             `json:"waiting"`
	Queued       uint             `json:"queued"`
	Extracting   uint             `json:"extracting"`
	Failed       uint             `json:"failed"`
	Extracted    uint             `json:"extracted"`
	Imported     uint             `json:"imported"`
	Deleted      uint             `json:"deleted"`
	HookOK       uint             `json:"hookOK"`
	HookFail     uint             `json:"hookFail"`
	CmdOK        uint             `json:"cmdOK"`
	CmdFail      uint             `json:"cmdFail"`
	Retries      uint             `json:"retries"`
	Finished     uint             `json:"finished"`
	Starrs       uint             `json:"starrs"`
	Folders      uint             `json:"folders"`
	Webhooks     uint             `json:"webhooks"`
	Cmdhooks     uint             `json:"cmdhooks"`
	StackFS      BufferStat       `json:"stackFS"`
	StackXtractr BufferStat       `json:"stackXtractr"`
	StackFolder  BufferStat       `json:"stackFolder"`
	StackHook    BufferStat       `json:"stackHook"`
	StackDel     BufferStat       `json:"stackDel"`
	StackTask    BufferStat       `json:"stackTask"`
	StarrQueues  []StarrQueueStat `json:"starrQueues,omitempty"`
}

Stats is filled and returned when a stats request is issued.

type StringSlice added in v0.11.2

type StringSlice []string

StringSlice allows a special environment variable unmarshaller for a lot of strings.

func (*StringSlice) MarshalENV added in v0.11.2

func (slice *StringSlice) MarshalENV(tag string) (map[string]string, error)

func (*StringSlice) UnmarshalENV added in v0.11.2

func (slice *StringSlice) UnmarshalENV(_, envval string) error

UnmarshalENV turns environment variables into a string slice.

type Unpackerr

type Unpackerr struct {
	*Flags
	*Config
	*History
	*xtractr.Xtractr

	*Logger
	// contains filtered or unexported fields
}

Unpackerr stores all the running data.

func New

func New() *Unpackerr

New returns an UnpackerPoller struct full of defaults. An empty struct will surely cause you pain, so use this!

func (*Unpackerr) CmdhookCounts

func (u *Unpackerr) CmdhookCounts() (uint, uint)

CmdhookCounts returns the total count of requests and errors for all command hooks.

func (*Unpackerr) ParseFlags

func (u *Unpackerr) ParseFlags() *Unpackerr

ParseFlags turns CLI args into usable data.

func (*Unpackerr) PollFolders

func (u *Unpackerr) PollFolders()

PollFolders begins the routines to watch folders for changes. if those changes include the addition of compressed files, they are processed for exctraction.

func (*Unpackerr) Run

func (u *Unpackerr) Run()

func (*Unpackerr) WebhookCounts

func (u *Unpackerr) WebhookCounts() (uint, uint)

WebhookCounts returns the total count of requests and errors for all webhooks.

type WebServer added in v0.12.0

type WebServer struct {
	Metrics      bool            `json:"metrics"      toml:"metrics"        xml:"metrics"        yaml:"metrics"`
	Pprof        bool            `json:"pprof"        toml:"pprof"          xml:"pprof"          yaml:"pprof"`
	LogFiles     int             `json:"logFiles"     toml:"log_files"      xml:"log_files"      yaml:"logFiles"`
	LogFileMb    int             `json:"logFileMb"    toml:"log_file_mb"    xml:"log_file_mb"    yaml:"logFileMb"`
	ListenAddr   string          `json:"listenAddr"   toml:"listen_addr"    xml:"listen_addr"    yaml:"listenAddr"`
	LogFile      string          `json:"logFile"      toml:"log_file"       xml:"log_file"       yaml:"logFile"`
	SSLCrtFile   string          `json:"sslCertFile"  toml:"ssl_cert_file"  xml:"ssl_cert_file"  yaml:"sslCertFile"`
	SSLKeyFile   string          `json:"sslKeyFile"   toml:"ssl_key_file"   xml:"ssl_key_file"   yaml:"sslKeyFile"`
	URLBase      string          `json:"urlbase"      toml:"urlbase"        xml:"urlbase"        yaml:"urlbase"`
	Upstreams    StringSlice     `json:"upstreams"    toml:"upstreams"      xml:"upstreams"      yaml:"upstreams"`
	WSOrigins    StringSlice     `json:"wsOrigins"    toml:"ws_origins"     xml:"ws_origins"     yaml:"wsOrigins"`
	UIPassword   CryptPass       `json:"uiPassword"   toml:"ui_password"    xml:"ui_password"    yaml:"uiPassword"`
	UIRoleHeader string          `json:"uiRoleHeader" toml:"ui_role_header" xml:"ui_role_header" yaml:"uiRoleHeader"`
	APIKeys      []APIKey        `json:"apiKeys"      toml:"api_keys"       xml:"api_keys"       yaml:"apiKeys"`
	Roles        map[string]Role `json:"roles"        toml:"roles"          xml:"roles"          yaml:"roles"`
	// contains filtered or unexported fields
}

func (*WebServer) Enabled added in v0.12.0

func (w *WebServer) Enabled() bool

func (*WebServer) HasPermission added in v1.0.0

func (w *WebServer) HasPermission(key, perm string) bool

func (*WebServer) PermissionsForKey added in v1.0.0

func (w *WebServer) PermissionsForKey(key string) []string

PermissionsForKey returns the union of role permissions for this key. Built-in admin is all permissions.

type WebhookConfig

type WebhookConfig = hooks.Config

Type aliases keep the daemon and tests on the historical names while the types themselves live in pkg/extract, pkg/hooks, and pkg/folders.

type WebhookPayload

type WebhookPayload = hooks.Payload

Type aliases keep the daemon and tests on the historical names while the types themselves live in pkg/extract, pkg/hooks, and pkg/folders.

type XtractPayload

type XtractPayload = hooks.XtractPayload

Type aliases keep the daemon and tests on the historical names while the types themselves live in pkg/extract, pkg/hooks, and pkg/folders.

Jump to

Keyboard shortcuts

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