Documentation
¶
Overview ¶
Package arrsvc composes the github.com/cplieger/arrapi Sonarr and Radarr clients with subflux's subtitle-specific operations: "wanted" iteration (which library items need a subtitle search), exclude-tag name resolution, and a fire-and-forget rescan. The raw library reads, per-item lookups, history polling, and connectivity ping are promoted from the embedded arrapi client unchanged, so this package adds only the app-level behavior arrapi deliberately does not provide.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AudioLanguages ¶ added in v0.4.0
AudioLanguages parses a file's MediaInfo audio-languages string into deduplicated ISO 639-1 codes. Returns nil when mi is nil or empty.
func HasExcludeTag ¶ added in v0.4.0
HasExcludeTag reports whether any of the item's tags are in the exclude set.
func OriginalLangCode ¶ added in v0.4.0
OriginalLangCode returns the ISO 639-1 code for an arr original-language reference, or "" when the reference is nil or the name is unmapped.
Types ¶
type APIKey ¶ added in v0.4.0
APIKey is arrapi's credential type, re-exported so callers convert with arrsvc.APIKey(...) instead of importing arrapi for one cast. An alias, not a new type: it IS the library's type, and a second distinct one would add a conversion without adding a guarantee.
type Radarr ¶
Radarr composes arrapi.Radarr with subflux's wanted-movie iteration, exclude-tag resolution, and error-only rescan.
func NewRadarr ¶
NewRadarr builds a Radarr service for the given base URL and API key. The key is typed for the same reason NewSonarr's is.
func (*Radarr) RescanMovie ¶
RescanMovie asks Radarr to rescan the movie's folder for new or changed files. Fire-and-forget, like RescanSeries.
func (*Radarr) ResolveExcludeTagIDs ¶
func (r *Radarr) ResolveExcludeTagIDs(ctx context.Context, names []string, logMissing bool) map[int]struct{}
ResolveExcludeTagIDs is the Radarr-side counterpart.
func (*Radarr) WantedMovies ¶ added in v0.4.0
func (r *Radarr) WantedMovies(ctx context.Context, excludeTagIDs map[int]struct{}, fn func(arrapi.Movie) error) error
WantedMovies invokes fn for every movie that needs a subtitle search. It fetches the full movie list first (closing that connection), then iterates locally, skipping movies with an excluded tag or no file.
type Sonarr ¶
Sonarr composes arrapi.Sonarr with subflux's wanted-episode iteration, exclude-tag resolution, and error-only rescan.
func NewSonarr ¶
NewSonarr builds a Sonarr service for the given base URL and API key.
The key is typed rather than a second string: the two were adjacent and both strings, so a transposed pair compiled and dialled the API key as a URL, putting the credential in the connection error. The conversion to arrapi's type used to happen INSIDE this function — one level past the boundary a caller can actually get wrong.
func (*Sonarr) RescanSeries ¶
RescanSeries asks Sonarr to rescan the series' folder for new or changed files (subflux calls this after writing a subtitle). It is fire-and-forget: arrapi returns the queued command, which subflux does not poll, so only the error is surfaced.
func (*Sonarr) ResolveExcludeTagIDs ¶
func (s *Sonarr) ResolveExcludeTagIDs(ctx context.Context, names []string, logMissing bool) map[int]struct{}
ResolveExcludeTagIDs returns the arr tag IDs matching the given tag names. When logMissing is true, names with no matching tag are logged once at INFO (coverage passes false to avoid repeating the message on every page load).
func (*Sonarr) WantedEpisodes ¶ added in v0.4.0
func (s *Sonarr) WantedEpisodes(ctx context.Context, excludeTagIDs map[int]struct{}, fn func(arrapi.Series, arrapi.Episode) error) error
WantedEpisodes invokes fn for every episode that needs a subtitle search. It fetches the full series list first (closing that connection), then fetches each non-excluded series' episodes concurrently (bounded to 6 goroutines), then invokes fn sequentially. A series whose episode fetch keeps failing is logged and skipped rather than aborting the whole scan.