class

ArrTop::Config

Inherits JSON::Serializable < YAML::Serializable < Reference < Object

Application configuration: the list of Sonarr/Radarr backends arrtop polls. Parses from either YAML or JSON (the same shape in both), so a config file can be authored in whichever the operator prefers.

Constants

DEFAULT_REFRESH = 2.seconds

Default TUI refresh interval when refresh is unset/blank/unparseable.

Constructors

from_file(path : String) : Config

Loads a config from path. YAML wins: .yml/.yaml parse as YAML, .json as JSON, and anything else tries YAML first then JSON.

Source
from_json(string : String) : Config

Parses a config from a JSON string.

Source
from_yaml(string : String) : Config

Parses a config from a YAML string.

Source
new(backends : Array(Backend) = [] of Backend, refresh : String | Nil = nil, download_clients : Array(DownloadClient) | Nil = nil)
Source
new(*, __context_for_yaml_serializable ctx : YAML::ParseContext, __node_for_yaml_serializable node : YAML::Nodes::Node)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

backends
Source
backends=(backends : Array(Backend))
Source
download_clients

Optional download clients arrtop queries for exact per-episode sizes. nil / absent ⇒ the feature is off and behaviour is identical to before (each season-pack episode is estimated as pack_total / episode_count). When present, every entry is validated by #validation_errors.

Source
download_clients=(download_clients : Array(DownloadClient) | Nil)

Optional download clients arrtop queries for exact per-episode sizes. nil / absent ⇒ the feature is off and behaviour is identical to before (each season-pack episode is estimated as pack_total / episode_count). When present, every entry is validated by #validation_errors.

Source
refresh

How often the TUI redraws, as <int>s / <int>ms / a bare integer (seconds). nil (unset) means the default; see #refresh_span. Validated by #validation_errors when set.

Source
refresh=(refresh : String | Nil)

How often the TUI redraws, as <int>s / <int>ms / a bare integer (seconds). nil (unset) means the default; see #refresh_span. Validated by #validation_errors when set.

Source
refresh_span

The refresh interval as a Time::Span: the parsed refresh value, or DEFAULT_REFRESH (2s) otherwise. (An unparseable value is also reported by #validation_errors.)

Source
validate

Validates the config, raising Config::Error listing all problems. Returns self when valid.

Source
validation_errors

Returns a list of all validation problems (empty when valid).

Source

Nested types