rank

package
v0.10.0-dev.21 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package rank answers how well a subtitle's release fits the video's, as tri-state facts and a Fit grade with no number anywhere. It reads release names parsed by internal/release; ordering and picking live in search.

Index

Constants

View Source
const RateTolerance = 0.0011

RateTolerance is the relative distance within which an fps value is a family member (subliminal's fps_matches).

Variables

This section is empty.

Functions

This section is empty.

Types

type Facts

type Facts struct {
	// Hash is a validated hash claim: void when identity was not confirmed
	// or Source or Cut is Differs.
	Hash                              bool
	Source, Group, Service, Cut, Rate Tri
	// PreRelease is true when exactly one side is a cam, telesync,
	// telecine, screener, regional or workprint release.
	PreRelease bool
	// SeasonPack is true when an episode's subtitle name states a season
	// and no episode; a tie-break only.
	SeasonPack bool
	// EpisodeByNumber marks a pack member chosen by its number alone: its
	// episode is unconfirmed, so its timing is never skipped. The engine
	// sets it, never Compare, and FitOf never reads it.
	EpisodeByNumber bool
}

Facts compares one subtitle's release with the video's.

func Compare

func Compare(video release.Parsed, videoFPS float64, sub release.Parsed, subFPS float64, m MatchedBy, identityOK bool) Facts

Compare builds the facts. Same and Differs need both sides known; Service compares only when both sources are web; Cut is Unknown when one side is unlabelled, compares primary cut tokens when both sides carry one (Same when they share one), is Differs when only one side does, and compares the Unrated, Uncut and Uncensored qualifiers only when neither side carries a primary cut; two pre-release sources compare Unknown. Hash holds only when m is Hash, identityOK is true and neither Source nor Cut is Differs.

type Fit

type Fit uint8

Fit grades Facts, ascending; the zero value is not a grade.

const (
	Conflict Fit = iota + 1
	Other
	SameSource
	SameRelease
	Exact
)

The grades.

func FitOf

func FitOf(f Facts) Fit

FitOf grades f: a hash is Exact; a differing cut or a one-sided pre-release is a Conflict; the same group with no differing source, service or rate is SameRelease; the same source with no differing rate is SameSource; anything else is Other.

func (Fit) MarshalText

func (f Fit) MarshalText() ([]byte, error)

MarshalText is conflict, other, same_source, same_release or exact; the zero value has no name.

func (*Fit) UnmarshalText

func (f *Fit) UnmarshalText(b []byte) error

UnmarshalText reads a grade's name and refuses every other spelling.

type MatchedBy

type MatchedBy uint8

MatchedBy is how the provider matched the query; diagnostic, except that only Hash can make a hash fact.

const (
	Title MatchedBy = iota + 1
	ID
	Hash
)

The matches; the zero value is not one.

func (MatchedBy) MarshalText

func (m MatchedBy) MarshalText() ([]byte, error)

MarshalText is title, id or hash; the zero value has no name.

func (*MatchedBy) UnmarshalText

func (m *MatchedBy) UnmarshalText(b []byte) error

UnmarshalText reads title, id or hash and refuses every other spelling.

type RateFamily

type RateFamily uint8

RateFamily groups frame rates that need no linear correction.

const (
	RateUnknown RateFamily = iota
	PAL                    // 25, 50
	Film                   // 23.976, 24, 29.97, 30, 47.95, 48, 59.94, 60
)

The families; RateUnknown is the zero value.

func RateFamilyOf

func RateFamilyOf(fps float64) RateFamily

RateFamilyOf answers RateUnknown for 0 and for a rate in no family.

type Tri

type Tri uint8

Tri is one fact's answer; Same and Differs need both sides known.

const (
	Unknown Tri = iota
	Same
	Differs
)

The answers; Unknown is the zero value and valid.

func (Tri) MarshalText

func (t Tri) MarshalText() ([]byte, error)

MarshalText is unknown, same or differs.

func (*Tri) UnmarshalText

func (t *Tri) UnmarshalText(b []byte) error

UnmarshalText reads unknown, same or differs and refuses every other spelling.

Jump to

Keyboard shortcuts

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