Help us shape the future of Go! Take the 2026 Go Developer Survey

libraryfilter

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package libraryfilter evaluates owner catalogue visibility rules without network access. The same compiled conditions drive local previews and every client. Rules run top to bottom and the first match wins. An empty action is hide, and an empty default is show, so a saved exclusion list hides the same titles as before.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountryAliases

func CountryAliases(v string) []string

TMDB movie production countries use names; TV origins use ISO codes. Match both forms, never infer a country from the spoken language.

Types

type Filter

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

func Compile

func Compile(specs []core.LibraryExclusion) (*Filter, error)

Compile treats every rule as hide and leaves unmatched titles visible.

func CompilePolicy added in v0.3.0

func CompilePolicy(specs []core.LibraryExclusion, fallback string) (*Filter, error)

CompilePolicy compiles ordered rules. fallback is "show" or "hide" for titles that match nothing; empty means show.

func (*Filter) CatchCountsSQL added in v0.3.0

func (f *Filter) CatchCountsSQL() (string, []any)

CatchCountsSQL returns one movie count and one show count per rule, in order. A title is counted on the first rule it matches.

func (*Filter) Fallback added in v0.3.0

func (f *Filter) Fallback() string

Fallback is "show" or "hide".

func (*Filter) Hidden

func (f *Filter) Hidden(t *core.Title) bool

func (*Filter) Passive added in v0.3.0

func (f *Filter) Passive() bool

Passive reports that the filter hides nothing.

func (*Filter) SQLHidden

func (f *Filter) SQLHidden() (string, []any)

SQLHidden returns a parameterized predicate for catalog_titles AS t. Hide-only rules with a show default stay an OR, which is the same predicate as first-match. A show rule or a hide default compiles to a CASE so the first match wins.

Jump to

Keyboard shortcuts

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