Documentation
¶
Overview ¶
Package parser reads release names and file names: the show title, year, season and episodes, and the quality, audio, language and release-group tags.
Package parser implements a comprehensive, unified release name parser. It extracts title, year, video quality, audio, edition, release group, language, and marker information from a single Parse() call.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeTitle ¶ added in v0.2.0
NormalizeTitle lowercases a title and reduces it to letters and digits so two titles can be compared without being tripped up by dots, underscores, spaces, or punctuation. Unicode-aware: accented letters fold to their ASCII base ("Pokémon" → "pokemon", matching release titles that drop the accent), non-Latin letters are kept (not deleted — deleting them normalized CJK titles to "" and made every comparison fail), and "&" folds to "and" so "Rick & Morty" matches "Rick.and.Morty".
Example:
NormalizeTitle("Breaking.Bad") == NormalizeTitle("breaking bad") == "breakingbad"
func QualityName ¶
QualityName returns the human-readable label for q, the same one the parser gives a release title (e.g. "Bluray-1080p x265 HDR10"). Used where a Quality is rebuilt from stored fields and has no Name yet.
func TitleMatches ¶ added in v0.2.0
TitleMatches reports whether a release's parsed show title refers to the same series as seriesTitle. Comparison is strict after normalization, with one concession: a trailing 4-digit year on the release side is allowed ("Breaking Bad 2008" matches "Breaking Bad") since indexer releases frequently embed the premiere year.
There is no fuzzy, substring or word-set matching: those let unrelated releases through, and the wrong show gets grabbed. Use TitleMatchesAny when the series carries explicit alternate titles (from TMDB).
func TitleMatchesAny ¶ added in v0.2.0
TitleMatchesAny reports whether a release's parsed show title matches any of the supplied candidate titles using the strict TitleMatches rules. Pass the canonical series title together with any alternate titles (from TMDB).
This is the right call for indexer-result filtering: an "Andor" series with alternate "Star Wars: Andor" will match release "Star Wars Andor S01..." because one of the candidates ("Star Wars: Andor") is itself a strict match. The strict semantics are preserved per-candidate — no fuzzy logic is added at the aggregate level.
Types ¶
type EpisodeInfo ¶
type EpisodeInfo struct {
// Season is the parsed season number (1-indexed; 0 = specials / unknown).
Season int
// Episodes is the list of episode numbers found in the filename.
// A multi-episode file like S02E03E04 will have [3, 4].
Episodes []int
// IsSeasonPack is true when the filename or directory name indicates an
// entire season rather than individual episodes (e.g. "Show.S02.BluRay").
IsSeasonPack bool
// AbsoluteEpisode is the parsed absolute episode number from anime-
// style titles ("[Group] Show - 48 [1080p]" → 48). Zero when the
// title doesn't match the absolute-pattern OR when SxxExx took
// precedence (the SxxExx form is preferred whenever both could
// apply, since it's less ambiguous).
AbsoluteEpisode int
}
EpisodeInfo holds the TV-episode-specific fields parsed from a filename.
type Language ¶
type Language string
Language identifies a detected language tag.
const ( LangEnglish Language = "english" LangFrench Language = "french" LangGerman Language = "german" LangSpanish Language = "spanish" LangItalian Language = "italian" LangPortuguese Language = "portuguese" LangRussian Language = "russian" LangJapanese Language = "japanese" LangKorean Language = "korean" LangChinese Language = "chinese" LangHindi Language = "hindi" LangArabic Language = "arabic" LangDutch Language = "dutch" LangNordic Language = "nordic" LangSwedish Language = "swedish" LangDanish Language = "danish" LangFinnish Language = "finnish" LangNorwegian Language = "norwegian" LangPolish Language = "polish" LangTurkish Language = "turkish" LangMulti Language = "multi" )
type ParsedRelease ¶
type ParsedRelease struct {
// Identity
Title string
Year int
ReleaseGroup string
// Episode info (TV-specific)
EpisodeInfo EpisodeInfo
// Video quality
Resolution plugin.Resolution
Source plugin.Source
Codec plugin.Codec
HDR plugin.HDRFormat
// Audio
AudioCodec plugin.AudioCodec
AudioChannels plugin.AudioChannels
// Edition
Edition string // canonical name, e.g. "Director's Cut"
// Languages
Languages []Language
// Revision
Revision Revision
// Markers / Flags
IsHybrid bool
Is3D bool
IsHardcodedSub bool
IsScene bool
IsSample bool
IsInternal bool
IsLimited bool
IsSubbed bool
IsDubbed bool
IsProper bool
IsRepack bool
// Source metadata
RawTitle string // original input before normalization
// Name is the human-readable quality label (e.g. "Bluray-1080p x265 HDR10").
QualityName string
}
ParsedRelease is the comprehensive result of parsing a release name.
func Parse ¶
func Parse(input string) ParsedRelease
Parse extracts all metadata from a release name or filename. It is a pure function with no external dependencies.
func (ParsedRelease) Quality ¶
func (p ParsedRelease) Quality() plugin.Quality
Quality returns the backward-compatible plugin.Quality struct.