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
- func AbsoluteConflict(parsed core.ReleaseInfo, absolute int) bool
- func AnimeReleaseStyle(name string, info core.ReleaseInfo) bool
- func AnimeSearchEpisode(req core.SearchRequest) int
- func ClassicPackEpisode(filePath string, wantSeason int) (int, bool)
- func ClassicPackEpisodeMatches(filePath string, wantSeason, wantEp int) bool
- func CompareTitleIDs(reported, expected core.IDs) (matched, conflicting bool)
- func DisclaimsDirector(name, director string) bool
- func DropTitleLanguages(langs []string, name, title string) []string
- func EpisodeMatches(parsed core.ReleaseInfo, season, episode int) bool
- func EpisodeMatchesAbsolute(parsed core.ReleaseInfo, absolute int) bool
- func EpisodeMatchesNumbering(parsed core.ReleaseInfo, season, episode, absolute int) bool
- func EpisodeMatchesRequest(info core.ReleaseInfo, req core.SearchRequest) bool
- func EpisodeSeriesYear(name string, parsedYear int) int
- func EpisodeTitleEvidence(name, want string) bool
- func EpisodeTitleMatches(name, want string) bool
- func ExplicitDub(name string) bool
- func FlagLanguages(text string) []string
- func HardSubbed(name string) bool
- func HasUsableInfo(info core.ReleaseInfo) bool
- func IsBaitFile(s string) bool
- func IsNonVideoRelease(name, fileName string, expectedTitles ...string) bool
- func IsObfuscated(title string) bool
- func IsPlaceholderResult(name string) bool
- func IsVideoRelease(name string) bool
- func KeywordMatch(name, keyword string) bool
- func KnownLanguage(v string) bool
- func LanguageBase(name string) string
- func LanguageMatch(release, want string) int
- func LanguageName(v string) string
- func MiniseriesPart(name string) (seriesTitle string, part int, ok bool)
- func MovieFileMatches(name string, titles []string, year int) bool
- func NamesSpecial(name string) bool
- func NormalizeTitle(s string) string
- func OrderMovieCandidates(cands []MovieCandidate, titles []string, originalLang string, wanted []string) []int
- func Parse(name string) core.ReleaseInfo
- func ParseEdition(name string) string
- func ParseSize(s string) int64
- func SeriesYearMatches(releaseYear, showYear int) bool
- func SpecialCountOnly(name string, shows ...string) bool
- func SpecialMatches(name, want string, others, shows []string) bool
- func SpecialNamesAnother(name, want string, others, shows []string) bool
- func SpecialSeriesTitle(name string) string
- func SpecialTitleAgrees(name, want string, shows ...string) bool
- func SpecialTitleEvidence(name, want string, shows ...string) bool
- func SpecialTitleNumberConflict(a, b map[string]bool) bool
- func SpecialTitleWords(title string, shows ...string) map[string]bool
- func StripTrailingLanguage(title string) (string, bool)
- func TitleAliases(title string) []string
- func TitleMatches(parsed core.ReleaseInfo, want string) bool
- func TitleMatchesAny(parsed core.ReleaseInfo, want string, alts []string) bool
- func TitlesMatch(a, b string) bool
- func Tokens(s string) []string
- func TrailingRegionTag(title string) string
- func YearMatches(got, want int) bool
- type MovieCandidate
- type PackEpisodeSizeGate
- type PackSizedFile
Constants ¶
const ( LanguageMulti = "multi" LanguageDual = "dual" 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.
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 AbsoluteConflict ¶
func AbsoluteConflict(parsed core.ReleaseInfo, absolute int) bool
AbsoluteConflict reports whether parsed info names absolute episode numbers and none of them is the wanted absolute count: the release names a different episode, whatever season numbering it also carries. A cour-numbered release's number is cour-local, not series-absolute, so cour releases never conflict on it.
func AnimeReleaseStyle ¶
func AnimeReleaseStyle(name string, info core.ReleaseInfo) bool
AnimeReleaseStyle reports whether a release name carries anime-specific packaging conventions that distinguish an animated series from a non-animated namesake:
- absolute episode numbering ("Show - 001", "Show S01E01 (001)");
- a bracketed fansub or anime release group ("[SubsPlease] Show...", "Show [Ember]");
- a bracketed 8-hex CRC32 checksum ("[A1B2C3D4]");
- anime release metadata tags ("[Dual Audio]", "BD"/"BDMUX", or "Batch").
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 ClassicPackEpisode ¶
ClassicPackEpisode extracts a classic pack episode key for wantSeason when no standard SxxExx marker is present ("Season 2/05 - Title.mkv", "205 - Title.avi", or miniseries "Part 2 - Title.mkv").
func ClassicPackEpisodeMatches ¶
ClassicPackEpisodeMatches reports whether a file in a season pack names the wanted episode the classic way, when no SxxExx is present: "Season 2/05 - Title.mkv", "205 - Title.avi", or a miniseries "Part 2 - Title.mkv". A season folder in the path must be the wanted season.
func CompareTitleIDs ¶ added in v0.2.4
CompareTitleIDs compares only shared identifier namespaces. A matching identifier is positive evidence. TMDB/TVDB conflicts always win; an IMDb conflict is tolerated only when both TMDB and TVDB independently agree. 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
DisclaimsDirector recognizes a narrowly phrased post-year disclaimer. It requires the complete director name: aliases and initials are not evidence.
func DropTitleLanguages ¶
DropTitleLanguages removes languages named only by the title's own words ("The French Dispatch", "The German Doctor") when the normalized title occurs inside name.
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" or "Show S10E01 (0337)").
func EpisodeMatchesNumbering ¶
func EpisodeMatchesNumbering(parsed core.ReleaseInfo, season, episode, absolute int) bool
EpisodeMatchesNumbering accepts canonical season numbering or verified absolute numbering. Some anime releases put the absolute number in Eyyyy; allow that only in season 1 or at 100+, never for specials or cour resets.
func EpisodeMatchesRequest ¶
func EpisodeMatchesRequest(info core.ReleaseInfo, req core.SearchRequest) bool
EpisodeMatchesRequest reports whether parsed info matches req's canonical episode, verified absolute count, anime cour mapping, or configured release numbering aliases. Shared by the resolver and Stremio stream name selection.
func EpisodeSeriesYear ¶ added in v0.2.4
EpisodeSeriesYear reads only the series portion of a TV name. A year in an episode title or after a season/episode boundary must not be mistaken for the show's premiere year.
func EpisodeTitleEvidence ¶
EpisodeTitleEvidence reports a positively matching episode subtitle. Unlike EpisodeTitleMatches, missing or generic subtitles carry no evidence.
func EpisodeTitleMatches ¶ added in v0.2.4
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
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
FlagLanguages returns the languages named by flag emoji in text, in order of appearance. Unknown flags are ignored.
func HardSubbed ¶
HardSubbed identifies explicit burned-in subtitle tags. Optional subtitle tracks (Subtitles, SUBPACK, MULTISUB) do not constitute this evidence.
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 IsBaitFile ¶
IsBaitFile reports whether s names an executable or shortcut bait file (.lnk, .exe, .scr, .bat, .msi, or double extensions like .mkv.lnk / .mp4.exe).
func IsNonVideoRelease ¶
IsNonVideoRelease reports whether a release name or file hint identifies executable/shortcut bait or a non-video release (soundtrack/OST, ebook/EPUB, audiobook). expectedTitles optionally lists known titles of the requested movie or series so words that belong to the title itself (e.g. "Soundtrack") are not mistaken for non-video release tags.
func IsObfuscated ¶
IsObfuscated reports whether a name/title looks like a hash or random string with no readable words.
func IsPlaceholderResult ¶
IsPlaceholderResult reports synthetic "no results" rows returned by Torznab/Jackett/Prowlarr bridges when an indexer refuses a text search (for example, "No results! Make sure to use the IMDb ID to search"). Real releases carrying technical metadata, years or episode markers are kept.
func IsVideoRelease ¶
IsVideoRelease reports whether name carries positive video release evidence (resolution, video codec/container, HDR, or video source tag) and is not a bait or non-video release (eBook, audiobook, soundtrack/OST).
func KeywordMatch ¶
KeywordMatch matches a complete token sequence, treating release separators alike. Subtitle keywords have no hidden aliases.
func KnownLanguage ¶
KnownLanguage reports whether v names a language the parser knows, in any form LanguageName accepts.
func LanguageBase ¶ added in v0.2.44
LanguageBase is a language name without its regional variant.
func LanguageMatch ¶ added in v0.2.44
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
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
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 MovieFileMatches ¶
MovieFileMatches requires an exact parsed title, never a prefix that can admit sequels. A year carried by the file or its nearest titled folder must agree too. Trailing language/audio/subtitle labels (e.g. "The.Mummy.FRENCH", "The Mummy (English)") and generic language-only filenames ("French/movie.mkv") inside single-movie dual-language packs are accepted when no folder contradicts the movie's title or year.
func NamesSpecial ¶
NamesSpecial requires an explicit special marker. Bare episode numbers and regular season packs do not establish season zero.
func NormalizeTitle ¶
NormalizeTitle lowercases, strips diacritics and punctuation, expands "&" to "and", and drops a leading article, for title comparisons.
func OrderMovieCandidates ¶
func OrderMovieCandidates(cands []MovieCandidate, titles []string, originalLang string, wanted []string) []int
OrderMovieCandidates returns a permutation of [0..len(cands)-1] preferring full-length, top-resolution candidates whose parsed audio matches wanted (in priority order) before falling back to largest byte size.
func Parse ¶
func Parse(name string) core.ReleaseInfo
Parse extracts structured info from a release name.
func ParseEdition ¶
ParseEdition identifies explicit cut labels without guessing from runtime.
func ParseSize ¶ added in v0.3.4
ParseSize reads sizes such as "1.4 GiB", "700 MB", "1,234.5 KB", "1.234,5 MB" or raw byte counts. Like Cardigann, decimal and binary units are both treated as powers of 1024. Unparseable input is 0.
func SeriesYearMatches ¶ added in v0.2.4
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 SpecialCountOnly ¶
SpecialCountOnly rejects group-local OAD/OVA counts without a title or an explicit S00Exx identity. A parent folder cannot confer a title on a count.
func SpecialMatches ¶
func SpecialNamesAnother ¶
SpecialNamesAnother compares the basename and immediate folder, ignoring the show name. A stronger sibling title overrides a coincidental number.
func SpecialSeriesTitle ¶
SpecialSeriesTitle reads the actual series prefix before a specials label. It never supplies a query's title as evidence for an add-on's answer.
func SpecialTitleAgrees ¶
SpecialTitleAgrees allows abbreviated subtitles after S00Exx only when at least half their meaningful words occur in the catalogue subtitle.
func SpecialTitleEvidence ¶
SpecialTitleEvidence is positive title evidence for a named OVA/OAD without catalogue episode numbering. Missing subtitles never provide evidence.
func SpecialTitleWords ¶
SpecialTitleWords drops filler, technical tags and the show's own names. Numbers are kept to distinguish named parts.
func StripTrailingLanguage ¶
StripTrailingLanguage removes one scene language token from a parsed title. It is a fallback for identity gates handling previously parsed releases; it deliberately uses the scene vocabulary rather than arbitrary language names.
func TitleAliases ¶ added in v0.2.4
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 TitleMatchesAny ¶
func TitleMatchesAny(parsed core.ReleaseInfo, want string, alts []string) bool
TitleMatchesAny reports whether parsed matches want or any of the supplied alternative titles.
func TitlesMatch ¶
TitlesMatch reports whether two raw titles are the same after normalisation.
func TrailingRegionTag ¶ added in v0.2.4
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 ¶
YearMatches reports whether two years agree within ±1 (zero = unknown).
Types ¶
type MovieCandidate ¶
MovieCandidate describes one playable movie file or archive set for language-aware multi-file pack ordering.
type PackEpisodeSizeGate ¶
type PackEpisodeSizeGate struct {
// contains filtered or unexported fields
}
PackEpisodeSizeGate rejects season-pack episode files whose per-episode byte size is an implausible outlier (< 15% or > 400% of the pack's median episode size), preventing samples, teasers, or full-season recap/extras files from standing in for an episode.
func NewPackEpisodeSizeGate ¶
func NewPackEpisodeSizeGate(entries []PackSizedFile, targetSeason, targetCour int) PackEpisodeSizeGate
NewPackEpisodeSizeGate builds a size gate from the playable candidates of a season pack for targetSeason (and optional targetCour). Specials (season <= 0) and single-episode releases are unconstrained.
type PackSizedFile ¶
PackSizedFile describes one candidate episode file or archive unit in a pack.