Documentation
¶
Overview ¶
Package scoring provides pure subtitle scoring and identity filtering.
Index ¶
- Variables
- func AnyReleaseNameMatches(req *api.SearchRequest, releaseName string) bool
- func AnyTitleMatches(req *api.SearchRequest, candidate string) bool
- func BuildMatches(video *api.VideoInfo, sub *api.Subtitle, deps MatchDeps) api.MatchSet
- func EpisodeNumberMatch(subSeason, subEpisode int, req *api.SearchRequest) bool
- func ExtractReleaseSeason(releaseName string) int
- func FilterByIdentity(results []api.Subtitle, req *api.SearchRequest) (kept []api.Subtitle, dropped int)
- func IdentityOK(sub *api.Subtitle, req *api.SearchRequest) bool
- func IdentityTitleOK(sub *api.Subtitle, req *api.SearchRequest) bool
- func IsSeasonPack(releaseName string) bool
- func MatchBreakdown(scores *api.Scores, matches api.MatchSet) map[string]int
- func NormalizeTitle(s string) string
- func ReleaseNameMatchesTitle(reqTitle, releaseName string) bool
- func TitlesMatch(requested, candidate string) bool
- type MatchDeps
- type ReleaseInfo
Constants ¶
This section is empty.
Variables ¶
var ( SeasonEpRe = regexp.MustCompile(`(?i)S\d{1,2}E\d{1,3}`) SeasonOnlyRe = regexp.MustCompile(`(?i)S(\d{1,2})(?:E\d{1,3})?`) )
SeasonEpRe matches S##E## episode markers in release names (e.g. S01E03).
Functions ¶
func AnyReleaseNameMatches ¶
func AnyReleaseNameMatches(req *api.SearchRequest, releaseName string) bool
AnyReleaseNameMatches reports whether releaseName contains any of the request's titles (primary or alternatives) after stripping release group tags.
func AnyTitleMatches ¶
func AnyTitleMatches(req *api.SearchRequest, candidate string) bool
AnyTitleMatches reports whether candidate matches the primary title or any alternative title in the request after normalization.
func BuildMatches ¶
BuildMatches compares video and subtitle release attributes, returning a set of matched attribute keys used by the scorer.
func EpisodeNumberMatch ¶
func EpisodeNumberMatch(subSeason, subEpisode int, req *api.SearchRequest) bool
EpisodeNumberMatch reports whether the subtitle's season/episode pair matches the request, including scene and absolute episode numbering alternatives.
func ExtractReleaseSeason ¶
ExtractReleaseSeason extracts the season number from a release name via the S##E## or S## pattern. Returns 0 if no season marker is found.
func FilterByIdentity ¶
func FilterByIdentity(results []api.Subtitle, req *api.SearchRequest) (kept []api.Subtitle, dropped int)
FilterByIdentity drops results that don't match the requested season/episode or show title. Returns the kept results and the number of dropped results so the caller can log as appropriate.
func IdentityOK ¶
func IdentityOK(sub *api.Subtitle, req *api.SearchRequest) bool
IdentityOK reports whether a subtitle passes the identity check for the given request. Hash-matched subtitles always pass. Subtitles with season/episode metadata are validated against the request's expected episode and title.
func IdentityTitleOK ¶
func IdentityTitleOK(sub *api.Subtitle, req *api.SearchRequest) bool
IdentityTitleOK reports whether the subtitle's title metadata is consistent with the search request. Subtitles matched by a stable ID (TVDB, IMDB, hash) skip title validation; title-matched subtitles must pass AnyTitleMatches.
func IsSeasonPack ¶
IsSeasonPack returns true if the release name looks like a season pack.
func MatchBreakdown ¶
MatchBreakdown returns the per-category score contributions for a match set.
func NormalizeTitle ¶
NormalizeTitle lowercases and replaces common separators with spaces.
func ReleaseNameMatchesTitle ¶
ReleaseNameMatchesTitle checks if a release name's title portion matches the requested title.
func TitlesMatch ¶
TitlesMatch compares two titles after normalization.