releaseparse

package
v0.2.49 Latest Latest
Warning

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

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

Documentation

Overview

Package releaseparse parses scene and P2P release names into core.ReleaseInfo. It is pure string work and safe for concurrent use.

Index

Constants

View Source
const (
	LanguageMulti              = "multi"
	LanguageSpanishLatino      = "spanish-latino"
	LanguageSpanishSpain       = "spanish-spain"
	LanguagePortugueseBrazil   = "portuguese-brazil"
	LanguagePortuguesePortugal = "portuguese-portugal"
)

Language names are the release parser's lower-case English names ("french", "japanese"). A regional variant that release groups label separately carries its region after a hyphen ("spanish-latino", "portuguese-brazil"); its base is the part before the hyphen.

View Source
const (
	LanguageNoMatch = iota
	// LanguageBaseMatch is the right language in another (or an unstated)
	// regional variant: Castilian or unlabelled Spanish for a Latino
	// preference.
	LanguageBaseMatch
	// LanguageExactMatch is the wanted language; a preference without a
	// variant accepts every variant of its language.
	LanguageExactMatch
)

Language match strengths (LanguageMatch).

Variables

This section is empty.

Functions

func AnimeSearchEpisode added in v0.2.44

func AnimeSearchEpisode(req core.SearchRequest) int

AnimeSearchEpisode is the absolute episode number an anime episode request is also searched by ("Show 1071"), or 0: the catalogue's count, or the episode itself in the first season.

func CompareTitleIDs added in v0.2.4

func CompareTitleIDs(reported, expected core.IDs) (matched, conflicting bool)

CompareTitleIDs compares only shared identifier namespaces. A matching identifier is positive evidence; any explicit conflict wins over a match. Missing identifiers carry no evidence and never become a match merely because the indexer was queried with the expected identifiers.

func DisclaimsDirector added in v0.2.49

func DisclaimsDirector(name, director string) bool

DisclaimsDirector recognizes a narrowly phrased post-year disclaimer. It requires the complete director name: aliases and initials are not evidence.

func EpisodeMatches

func EpisodeMatches(parsed core.ReleaseInfo, season, episode int) bool

EpisodeMatches reports whether parsed info is exactly the wanted episode (not a season pack, season matches, episode is listed).

func EpisodeMatchesAbsolute added in v0.2.44

func EpisodeMatchesAbsolute(parsed core.ReleaseInfo, absolute int) bool

EpisodeMatchesAbsolute reports whether parsed info is the episode whose number counted from the series start is absolute: an anime release numbered that way ("Show - 1071") and naming no season.

func EpisodeSeriesYear added in v0.2.4

func EpisodeSeriesYear(name string, parsedYear int) int

EpisodeSeriesYear reads only the series portion of a TV name. A year in an episode title must not be mistaken for the show's premiere year.

func EpisodeTitleMatches added in v0.2.4

func EpisodeTitleMatches(name, want string) bool

EpisodeTitleMatches rejects an explicitly different episode title between SxxExx and the technical metadata. Unnamed scene releases remain eligible. A title is only extracted when a recognized metadata boundary follows it.

func ExplicitDub added in v0.2.9

func ExplicitDub(name string) bool

ExplicitDub reports a dub declaration in release metadata, not a title word. Language parsing alone is not enough: foreign originals remain welcome.

func FlagLanguages added in v0.2.44

func FlagLanguages(text string) []string

FlagLanguages returns the languages named by flag emoji in text, in order of appearance. Unknown flags are ignored.

func HasUsableInfo

func HasUsableInfo(info core.ReleaseInfo) bool

HasUsableInfo reports whether parsed info carries enough technical detail to consider a release whose title cannot be verified.

func IsObfuscated

func IsObfuscated(title string) bool

IsObfuscated reports whether a name/title looks like a hash or random string with no readable words.

func LanguageBase added in v0.2.44

func LanguageBase(name string) string

LanguageBase is a language name without its regional variant.

func LanguageMatch added in v0.2.44

func LanguageMatch(release, want string) int

LanguageMatch reports how well a release language satisfies a wanted language. Both may be any form LanguageName accepts.

func LanguageName added in v0.2.44

func LanguageName(v string) string

LanguageName names a language preference or code the way the parser names release languages: ISO 639 codes and BCP 47 tags ("fr", "fra", "es-419", "pt-BR"), parser names ("french", "Spanish-Latino") and the scene words for regional variants ("latino", "castellano", "brazilian"). Unknown values are returned lower-cased.

func MiniseriesPart added in v0.2.4

func MiniseriesPart(name string) (seriesTitle string, part int, ok bool)

MiniseriesPart extracts the series title and 1-based part number from a miniseries release named "Show.Name.Part.3.Episode.Title.1080p.BluRay" or "Show.Name.1990.Pt.01.720p". It is used only when resolving a Season 1 episode so movie titles ("Dune Part Two") are unaffected.

func NormalizeEdition

func NormalizeEdition(name string) string

NormalizeEdition maps an edition label found in a release name (or an already-normalized one) to the canonical cut name, "" when there is no explicit cut. Two releases belong to the same cut when their normalized editions match.

func NormalizeTitle

func NormalizeTitle(s string) string

NormalizeTitle lowercases, strips diacritics and punctuation, expands "&" to "and", and drops a leading article, for title comparisons.

func Parse

func Parse(name string) core.ReleaseInfo

Parse extracts structured info from a release name.

func ParseEdition

func ParseEdition(name string) string

ParseEdition identifies explicit cut labels without guessing from runtime.

func SeriesYearMatches added in v0.2.4

func SeriesYearMatches(releaseYear, showYear int) bool

SeriesYearMatches distinguishes same-named series and reboots. A year explicitly present in a TV release identifies the series, not the episode's air year. Releases omitting a year remain eligible.

func TitleAliases added in v0.2.4

func TitleAliases(title string) []string

TitleAliases returns alternative search query titles for titles with initialisms, explicit subtitles, parenthetical disambiguators or Roman numerals. Ordinary titles return nil so standard searches spend no extra budget hits.

func TitleMatches

func TitleMatches(parsed core.ReleaseInfo, want string) bool

TitleMatches reports whether a parsed release title matches the wanted title.

func TitleYearMatches

func TitleYearMatches(parsed core.ReleaseInfo, want string, wantYear int) bool

TitleYearMatches is TitleMatches plus a year check with ±1 tolerance. A zero year on either side skips the year check.

func TitlesMatch

func TitlesMatch(a, b string) bool

TitlesMatch reports whether two raw titles are the same after normalisation.

func TrailingRegionTag added in v0.2.4

func TrailingRegionTag(title string) string

TrailingRegionTag returns the canonical region code ("us", "uk", "au", "ca", "nz") when a release or show title ends with an explicit country disambiguator ("The.Office.US", "Ghosts (UK)"), or "".

func YearMatches

func YearMatches(got, want int) bool

YearMatches reports whether two years agree within ±1 (zero = unknown).

Types

This section is empty.

Jump to

Keyboard shortcuts

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