language

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 8 Imported by: 0 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

Overview

Package language implements the language preference: which audio languages a release may be in. Releases in no wanted language are tagged with FilterReason, so auto-search and RSS skip them and interactive search shows them grayed with an override.

Languages come from the release title (internal/parser). As in Sonarr, a release with no language tag is assumed to be English, and a MULTI release matches any wanted language.

Index

Constants

View Source
const FilterReason = "unwanted_language"

FilterReason tags a release in no wanted language.

Variables

Known lists the languages a preference can name, in display order. "multi" is not one: it is a property of a release, not a language.

Functions

This section is empty.

Types

type Preference

type Preference struct {
	// Languages are the wanted languages. Empty means any language.
	Languages []string `json:"languages"`
}

Preference is the saved language preference.

func Default

func Default() Preference

Default is any language: the behavior before the preference existed.

func (Preference) Accepts

func (p Preference) Accepts(langs []parser.Language) bool

Accepts reports whether a release with these parsed languages is wanted.

func (Preference) AcceptsTitle

func (p Preference) AcceptsTitle(title string) bool

AcceptsTitle parses the release title and reports whether it is wanted.

func (Preference) Validate

func (p Preference) Validate() error

Validate checks that every language is known and listed once.

type Store

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

Store loads and saves the preference in the settings table.

func NewStore

func NewStore(q db.Querier) *Store

NewStore creates a Store.

func (*Store) Get

func (s *Store) Get(ctx context.Context) (Preference, error)

Get returns the saved preference, or Default() when none is saved.

func (*Store) Set

func (s *Store) Set(ctx context.Context, p Preference) error

Set validates and saves p.

type ValidationError

type ValidationError struct{ Msg string }

ValidationError explains why a preference can't be saved.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Jump to

Keyboard shortcuts

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