Documentation
¶
Overview ¶
Package parser extracts release metadata from torrent names using an ordered handler table with a literal prefilter.
Index ¶
- func EpisodesFromSeason(rawTitle string, season int) []int
- func ExtractEpisodes(rawTitle string) []int
- func ExtractSeasons(rawTitle string) []int
- func GetPartialParser(fieldNames []string) func(title string) *Result
- func LanguageName(code string) string
- func ResolutionHeight(resolution string) string
- func TranslateLanguages(codes []string) []string
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EpisodesFromSeason ¶
EpisodesFromSeason returns the episode numbers only when the given season number is present in the title.
func ExtractEpisodes ¶
ExtractEpisodes parses a title and returns just its episode numbers.
func ExtractSeasons ¶
ExtractSeasons parses a title and returns just its season numbers.
func GetPartialParser ¶
func LanguageName ¶
LanguageName returns the English name for a language code the parser emits, or "" when unknown.
func ResolutionHeight ¶ added in v0.3.3
ResolutionHeight reduces a WxH resolution to its height. Titles that spell out both dimensions parse to the full pair ("720x480p"), which callers matching on tiers would otherwise key off the width. Values that are not WxH are returned lowercased and unchanged.
func TranslateLanguages ¶
TranslateLanguages converts language codes to English names, dropping codes with no translation (PTT translate_langs semantics).
Types ¶
type Result ¶
type Result struct {
Adult bool `json:"adult"`
Audio []string `json:"audio"`
BitDepth string `json:"bit_depth"`
Bitrate string `json:"bitrate"`
Channels []string `json:"channels"`
Codec string `json:"codec"`
Commentary bool `json:"commentary"`
Complete bool `json:"complete"`
Container string `json:"container"`
Convert bool `json:"convert"`
Country string `json:"country"`
Date string `json:"date"`
Documentary bool `json:"documentary"`
Dubbed bool `json:"dubbed"`
Edition string `json:"edition"`
EpisodeCode string `json:"episode_code"`
Episodes []int `json:"episodes"`
Extension string `json:"extension"`
Extras []string `json:"extras"`
Group string `json:"group"`
HDR []string `json:"hdr"`
Hardcoded bool `json:"hardcoded"`
Languages []string `json:"languages"`
Network string `json:"network"`
PPV bool `json:"ppv"`
Proper bool `json:"proper"`
Quality string `json:"quality"`
Region string `json:"region"`
Remastered bool `json:"remastered"`
Repack bool `json:"repack"`
Resolution string `json:"resolution"`
Retail bool `json:"retail"`
Scene bool `json:"scene"`
Seasons []int `json:"seasons"`
Site string `json:"site"`
Size string `json:"size"`
Subbed bool `json:"subbed"`
ThreeD bool `json:"3d"`
Title string `json:"title"`
Torrent bool `json:"torrent"`
Trash bool `json:"trash"`
Uncensored bool `json:"uncensored"`
Unrated bool `json:"unrated"`
Upscaled bool `json:"upscaled"`
Volumes []int `json:"volumes"`
Year string `json:"year"`
// contains filtered or unexported fields
}
func ParseAll ¶
ParseAll parses a batch in parallel. The result is index-aligned with the input: out[i] is the parse of titles[i].
func (*Result) LanguageNames ¶
LanguageNames returns the result's languages as English names.