Documentation
¶
Overview ¶
Package words 套用识别词:解析标题之前屏蔽或替换文字,解析之后按规则偏移集数。
Index ¶
Constants ¶
const ( MaxPatternLen = 256 MaxOffset = 9999 )
识别词的长度与偏移上限。
Variables ¶
This section is empty.
Functions ¶
func Validate ¶
func Validate(r models.MediaWordRule) error
Validate 检查一条识别词:种类、非空的匹配文字、正则能编译、集数偏移不为 0 且在范围内。
Types ¶
type Applied ¶
Applied 是套用识别词之后的标题与副标题,以及命中的规则与合计的集数偏移。
func Apply ¶
func Apply(rules []models.MediaWordRule, title, subtitle string) Applied
Apply 按顺序套用识别词(调用方只传启用的)。检查不过的规则跳过。
func (Applied) ApplyOffset ¶
ApplyOffset 把合计的集数偏移加到解析结果上。起始集减到 1 以下时整个范围当作没有(偏移配错了, 不留下只有结束集的范围);结束集减到 1 以下或不大于起始集时只去掉结束集。