parser

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package parser extracts release metadata from torrent names using an ordered handler table with a literal prefilter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EpisodesFromSeason

func EpisodesFromSeason(rawTitle string, season int) []int

EpisodesFromSeason returns the episode numbers only when the given season number is present in the title.

func ExtractEpisodes

func ExtractEpisodes(rawTitle string) []int

ExtractEpisodes parses a title and returns just its episode numbers.

func ExtractSeasons

func ExtractSeasons(rawTitle string) []int

ExtractSeasons parses a title and returns just its season numbers.

func GetPartialParser

func GetPartialParser(fieldNames []string) func(title string) *Result

func LanguageName

func LanguageName(code string) string

LanguageName returns the English name for a language code the parser emits, or "" when unknown.

func ResolutionHeight added in v0.3.3

func ResolutionHeight(resolution string) string

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

func TranslateLanguages(codes []string) []string

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 Parse

func Parse(title string) *Result

func ParseAll

func ParseAll(titles []string) []*Result

ParseAll parses a batch in parallel. The result is index-aligned with the input: out[i] is the parse of titles[i].

func (*Result) Error

func (r *Result) Error() error

func (*Result) LanguageNames

func (r *Result) LanguageNames() []string

LanguageNames returns the result's languages as English names.

func (*Result) Normalize

func (r *Result) Normalize() *Result

Jump to

Keyboard shortcuts

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