epoffset

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package epoffset 按追剧的集号偏移规则换算种子标题与文件名里的集号:TMDB 的集号 = 写的集号 + 偏移。订阅对种子、按文件认集 与整理入库都按这里换算跨季接着编号的集,几边算出的集一致。

规则:

  • 写的季就是追剧的季:整段加上偏移,不到第 1 集的部分去掉;整段都不到第 1 集时换算不了(见 Shift)。规则勾了「跨季接着编号」 时不这样算:这个组接着编的集写的是前面的季,写成这一季的是正常编号的集,按 TMDB 的集号。
  • 规则勾了「跨季接着编号」(这个组把这一季接着前面的季往下编,例如第 2 季第 1 集写成 S01E171)、写的是前面的季:整段加上偏移、 去掉不到第 1 集的部分,算作追剧这一季的集(见 Cross)。只写了集号的当作第 1 季,写明 S00 的特别篇不算(见 Special)。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cross

func Cross(r Rule, season, follow, start, end, total int, count func(season int) int) (from, to int, ok bool)

Cross 按跨季接着编号的规则 r 把写的是第 season 季(0 是只写了集号,当作第 1 季)第 start–end 集的换成追剧第 follow 季的集, 换不了时 ok 为假(不是这一季的集):

  • 规则要能跨季(见 Crosses);
  • 写的季比追剧的季早一季以上时(追第 3 季、写的是第 1 季),只算集号比 TMDB 上那一季的集数(count 给的,0 是不知道)大的部分: 这个组可能是从中间某一季才开始接着编的,那一季集数以内的集号是那一季自己的集。早一季时不这样算,偏移本身就是那一季的集数;
  • 加上偏移,不到第 1 集的部分去掉,整段都不到第 1 集的是前面那一季的集;
  • 换出来的第一集在这一季的总集数(total,0 是不知道)以后的是后面的季的集。

func Key

func Key(group string) string

Key 是制作组在 Rules 里的写法。

func Shift

func Shift(offset, start, end int) (from, to int, ok bool)

Shift 把第 start 到第 end 集(end 小于 start 时是一集)加上偏移,去掉不到第 1 集的部分。整段都不到第 1 集时 ok 为假。

func Special

func Special(name string) bool

Special 报告标题或文件名写明了是第 0 季(特别篇:S00E05、S00.EP05、Season 0、第0季,认法同解析标题的,见 meta.WrittenSeason): 解析出的季可能是 0(和只写了集号的一样)或副标题里写的季,跨季时要分开。

Types

type Rule

type Rule struct {
	Offset int
	// Cross 是这个组跨季接着编号
	Cross bool
}

Rule 是一个制作组的集号偏移。Offset 为 0 的是别的方式的规则(按 TMDB 的集号、按期号、按日期),不换算。

func (Rule) Crosses

func (r Rule) Crosses(season, follow int) bool

Crosses 报告写的是第 season 季(0 是只写了集号,当作第 1 季)的集能不能按这条规则跨季算作第 follow 季的:规则勾了跨季、 偏移小于 0,写的季在追剧的季前面。

type Rules

type Rules map[string]Rule

Rules 是一个追剧的集号规则里每个制作组的偏移(制作组小写,空串是所有组)。别的方式的规则也在里面(偏移是 0):这个组 有自己的规则时不用所有组的那条。

func (Rules) For

func (rs Rules) For(group string) (Rule, bool)

For 是制作组 group 的规则:这个组自己的,没有时是所有组的那条。

Jump to

Keyboard shortcuts

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