Documentation
¶
Overview ¶
Package epmarker is the one authority for what a release or archive member name claims about its season and episode. A name is read once into tokens, runs of ASCII letters and digits, and every view classifies those tokens; every notation is case-insensitive.
- Claims: S##E## markers (S## E## too, across up to three of " ._-") and ##x## tokens, then the episodes stated under a season, ranges expanded.
- FirstIndex, Present: where a marker-shaped token starts, unreadable digits included, so such a name still reaches no fallback.
- Season: the first S##E## or S## token, else "Season N", else ##x##.
- StatesEpisode: a marker, E##, EP##, Episode N, " - NN" after the season or a range right after it or opening a bracket; a season pack states a Season and none.
- Absolute: an episode number with no season attached (the caller supplies it); BareEpisode: a leading number in a name with no readable marker.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Absolute ¶
Absolute returns the episode a name with no marker shape states by one number, as batch entries name their files ("[Group] Show - 26"): the last " - NN", since a title's number comes first, else the first E##, EP## or Episode N, else the last spaced NN that is no bit depth and that a space, the name's end or a file suffix follows ("Mob Psycho 100 05.mkv" states 5, "Show 02 10 bits" 2). A range's number or a bracketed bare one is none. ok is false when no form is present, the number overflows an int, or Present reports a marker shape.
func BareEpisode ¶ added in v0.4.35
BareEpisode returns the episode a name states as a bare leading number: "6 - A Golden Crown..srt" states episode 6. The number is the name's first token, one to three digits, followed by one of " ._-", so a resolution ("1080p") or a year ("2011 - ") is none. A name with a readable marker returns false. A bare number names no season: a caller reads it only under a season known from outside the name, where no other name it reads alongside claims a marker.
func FirstIndex ¶
FirstIndex returns the byte offset at which the first marker-shaped token starts, or -1 when name carries none. Used to split a release name into its title portion and its marker portion.
func Present ¶
Present reports whether name carries a marker-shaped token at all. This is the gate for "the name numbers its episodes some other way, fall back": a name containing an unparseable marker is still explicitly numbered, so it must not reach an absolute-number or season-pack fallback.
func Season ¶
Season returns the season of name's first S## token, a marker's S## included, else of "Season N", else of the cross form, so Season never contradicts Claims ("Black Sails - 01x08" is season 1). ok is false when name carries no season token or its digits do not fit an int.
func StatesEpisode ¶
StatesEpisode reports whether name states an episode, as one number or a range: a marker-shaped token (Present), an E##, EP## or Episode N, or bare digits after a season statement, as " - 05" or as a range right after it or opening a bracket ("S2 01-12", "S2 [01 ~ 12]"). Other bare digits may be a title's, a volume's ("Vol.1-6"), a bit depth's ("10 bit"), a CRC's or a date's, so none of those states one. A season pack is a name with a Season that states none.
Types ¶
type Marker ¶
Marker is the season/episode pair one token claims. Both numbers are non-negative: they are read from digit runs, so "S00E00" is a legitimate Marker{0, 0} rather than a miss.
func Claims ¶ added in v0.4.35
Claims returns every episode name claims, ordered, deduplicated, nil when it claims none: its markers, and each episode StatesEpisode reads under its marker's season, else the latest season statement before it; a range longer than maxRangeSpan claims its first. It selects archive members, so a number with no season before it ("E01-E02") claims nothing: guessing one risks the wrong episode's subtitle written under the right episode's name.