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 ¶
const FilterReason = "unwanted_language"
FilterReason tags a release in no wanted language.
Variables ¶
var Known = []parser.Language{ parser.LangEnglish, parser.LangFrench, parser.LangGerman, parser.LangSpanish, parser.LangItalian, parser.LangPortuguese, parser.LangDutch, parser.LangRussian, parser.LangPolish, parser.LangTurkish, parser.LangArabic, parser.LangHindi, parser.LangJapanese, parser.LangKorean, parser.LangChinese, parser.LangSwedish, parser.LangDanish, parser.LangNorwegian, parser.LangFinnish, parser.LangNordic, }
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.
type ValidationError ¶
type ValidationError struct{ Msg string }
ValidationError explains why a preference can't be saved.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string