Поддержка тегирования по атрибуту tvg-name канала

This commit is contained in:
2025-05-13 16:48:34 +08:00
parent 4772f0179d
commit 01ddf25ed5

View File

@@ -18,9 +18,10 @@ import (
// TagBlock описывает объект с набором тегов, который подходит для каналов по регулярному выражению
type TagBlock struct {
TvgId string `json:"tvg-id"`
Title string `json:"title"`
Tags []string `json:"tags"`
TvgId string `json:"tvg-id"`
TvgName string `json:"tvg-name"`
Title string `json:"title"`
Tags []string `json:"tags"`
}
// GetTags возвращает теги, соответствующие каналу
@@ -42,6 +43,18 @@ func (block *TagBlock) GetTags(ch playlist.Channel) []string {
if checkString == "" {
return result
}
} else if block.TvgName != "" {
regex, err = regexp.Compile(block.TvgName)
if err != nil {
return result
}
if _, ok := ch.Attributes["tvg-name"]; !ok {
return result
}
checkString = ch.Attributes["tvg-name"]
if checkString == "" {
return result
}
} else if block.Title != "" {
regex, err = regexp.Compile(block.Title)
if err != nil {