tnp

package module
v0.0.0-...-690b626 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: MIT Imports: 7 Imported by: 0

README

torrent name parser

Documentation

Index

Constants

View Source
const (
	TypeTVSeries = MediaType("tv_series")
	TypeTVSeason = MediaType("tv_season")
	TypeMovie    = MediaType("movie")
)

Variables

View Source
var Patterns = map[string][]Pattern{
	"network": {
		{`\bMyTVS\b`, "MyTVS"},
		{`\bATVP\b`, "Apple TV+"},
		{`\bAMZN|Amazon\b`, "Amazon Studios"},
		{`\bNF|Netflix\b`, "Netflix"},
		{`\bNICK\b`, "Nickelodeon"},
		{`\bRED\b`, "YouTube Premium"},
		{`\bDSNY?P\b`, "Disney Plus"},
		{`\bDSNY\b`, "DisneyNOW"},
		{`\bHMAX\b`, "HBO Max"},
		{`\bHBO\b`, "HBO"},
		{`\bHULU\b`, "Hulu Networks"},
		{`\bMS?NBC\b`, "MSNBC"},
		{`\bDCU\b`, "DC Universe"},
		{`\bID\b`, "Investigation Discovery"},
		{`\biT\b`, "iTunes"},
		{`\bAS\b`, "Adult Swim"},
		{`\bCRAV\b`, "Crave"},
		{`\bCC\b`, "Comedy Central"},
		{`\bSESO\b`, "Seeso"},
		{`\bVRV\b`, "VRV"},
		{`\bPCOK\b`, "Peacock"},
		{`\bCBS\b`, "CBS"},
		{`\biP\b`, "BBC iPlayer"},
		{`\bNBC\b`, "NBC"},
		{`\bAMC\b`, "AMC"},
		{`\bPBS\b`, "PBS"},
		{`\bSTAN\b`, "Stan."},
		{`\bRTE\b`, "RTE Player"},
		{`\bCR\b`, "Crunchyroll"},
		{`\bANPL\b`, "Animal Planet Live"},
		{`\bDTV\b`, "DirecTV Stream"},
		{`\bVICE\b`, "VICE"},
	},
	"quality": {
		{`\bWEB[ -.]?DL(?:Rip|Mux)?|HDRip`, "WEB-DL"},
		{`\bWEB[ -]?Cap\b`, "WEBCap"},
		{`\bW[EB]B[ -]?(?:Rip)|WEB\b`, "WEBRip"},
		{`\b(?:HD)?CAM(?:-?Rip)?\b`, "Cam"},
		{`\b(?:HD)?TS|TELESYNC|PDVD|PreDVDRip\b`, "Telesync"},
		{`\bWP|WORKPRINT\b`, "Workprint"},
		{`\b(?:HD)?TC|TELECINE\b`, "Telecine"},
		{`\b(?:DVD)?SCR(?:EENER)?|BDSCR\b`, "Screener"},
		{`\bDDC\b`, "Digital Distribution Copy"},
		{`\bDVD-?(?:Rip|Mux)\b`, "DVD-Rip"},
		{`\bDVDR|DVD-Full|Full-rip\b`, "DVD-R"},
		{`\bPDTV|DVBRip\b`, "PDTV"},
		{`\bDSR(?:ip)?|SATRip|DTHRip\b`, "DSRip"},
		{`\bAHDTV(?:Mux)?\b`, "AHDTV"},
		{`\bHDTV(?:Rip)?\b`, "HDTV"},
		{`\bD?TVRip|DVBRip\b`, "TVRip"},
		{`\bVODR(?:ip)?\b`, "VODRip"},
		{`\bHD-Rip\b`, "HD-Rip"},
		{fmt.Sprintf(`\bBlu-?Ray%sRip|BDR(?:ip)?\b`, delimiters), "BDRip"},
		{`\bBlu-?Ray|(?:US|JP)?BD(?:remux)?\b`, "Blu-ray"},
		{`\bBR-?Rip\b`, "BRRip"},
		{`\bHDDVD\b`, "HD DVD"},
		{`\bPPV(?:Rip)?\b`, "Pay-Per-View Rip"},
	},
	"resolution": {
		{`\b([0-9]{3,4}(?:p|i))\b`, ""},
		{`\b(1280x720p?)\b`, "720p"},
		{`\bFHD|1920x1080p?\b`, "1080p"},
		{`\bUHD\b`, "UHD"},
		{`\bHD\b`, "HD"},
		{`\b4K\b`, "4K"},
	},
	"year": {
		{`\b(?:19|20)[0-9]{2}-(?:19|20)[0-9]{2}\b`, ""},
		{`\b(?:19|20)[0-9]{2}\b`, ""},
	},
	"codec": {
		{"xvid", "Xvid"},
		{"av1", "AV1"},
		{fmt.Sprintf("[hx]%s?264", delimiters), "H.264"},
		{"AVC", "H.264"},
		{fmt.Sprintf("HEVC(?:{d}Main%s?10P?)", delimiters), "H.265 Main 10"},
		{fmt.Sprintf("[hx]%s?265", delimiters), "H.265"},
		{"HEVC", "H.265"},
		{fmt.Sprintf("[h]%s?263", delimiters), "H.263"},
		{"VC-1", "VC-1"},
	},
	"audio": genAudioPatterns(),
	"bit_depth": {
		{`(8|10)-?bits?`, ""},
	},
	"audio_track": {
		{`\d+Audio`, ""},
	},
}

Functions

This section is empty.

Types

type Match

type Match struct {
	Type    string
	Start   int
	End     int
	Content string
}

type MediaType

type MediaType string

type Parsed

type Parsed struct {
	Name       string
	Year       string
	Producer   string
	Codec      string
	BitDepth   string
	Audio      string
	Resoluton  string
	Quality    string
	Season     []int
	Episode    []int
	Network    string
	Excess     []string
	MediaType  MediaType
	AudioTrack string
}

func Parse

func Parse(title string, standard bool) *Parsed

type Pattern

type Pattern struct {
	Regex   string
	Replace string
}

Jump to

Keyboard shortcuts

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