epg

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package epg provides Electronic Program Guide (EPG) functionality including fuzzy matching and XMLTV generation.

Package epg provides Electronic Program Guide (EPG) functionality including fuzzy matching and XMLTV generation.

Package epg provides Electronic Program Guide (EPG) functionality including fuzzy matching and XMLTV generation.

Package epg provides Electronic Program Guide (EPG) functionality including fuzzy matching and XMLTV generation.

Package epg provides Electronic Program Guide functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildNameToIDMap

func BuildNameToIDMap(xmltvPath string) (map[string]string, error)

BuildNameToIDMap reads an XMLTV file and returns a map[nameKey]=channelID. It expects elements matching the `Channel` type defined in generator.go.

func FindBest

func FindBest(name string, nameToID map[string]string, maxDist int) (string, bool)

FindBest finds the best matching channel name using fuzzy string matching. It performs exact or fuzzy matching (Levenshtein) up to maxDist.

func NameKey

func NameKey(s string) string

NameKey generates a normalized key from a channel name for matching.

func WriteXMLTV

func WriteXMLTV(tv TV, outputPath string) error

WriteXMLTV writes XMLTV data to a file atomically using temp file + rename.

Types

type Channel

type Channel struct {
	ID          string   `xml:"id,attr"`
	DisplayName []string `xml:"display-name"`
	Icon        *Icon    `xml:"icon,omitempty"`
}

Channel represents an XMLTV channel with its metadata.

type Icon

type Icon struct {
	Src string `xml:"src,attr"`
}

Icon represents a channel icon in XMLTV format.

type Programme

type Programme struct {
	Start   string `xml:"start,attr"`
	Stop    string `xml:"stop,attr"`
	Channel string `xml:"channel,attr"`
	Title   Title  `xml:"title"`
	Desc    string `xml:"desc,omitempty"`
}

Programme represents a TV programme in XMLTV format.

func ProgrammesFromEPG

func ProgrammesFromEPG(events []openwebif.EPGEvent, channelID string) []Programme

ProgrammesFromEPG converts OpenWebIF EPG events to XMLTV Programme format

type TV

type TV struct {
	XMLName      xml.Name    `xml:"tv"`
	Generator    string      `xml:"generator-info-name,attr,omitempty"`
	GeneratorURL string      `xml:"generator-info-url,attr,omitempty"`
	Channels     []Channel   `xml:"channel"`
	Programs     []Programme `xml:"programme"`
}

TV represents the root XMLTV document structure.

func GenerateXMLTV

func GenerateXMLTV(channels []Channel, programs []Programme) TV

GenerateXMLTV generates an XMLTV document from channel and EPG data.

type Title

type Title struct {
	// Lang contains the language code for the title (optional).
	Lang string `xml:"lang,attr,omitempty"`
	// Text is the title text itself.
	Text string `xml:",chardata"`
}

Title represents a programme title with language support.

Jump to

Keyboard shortcuts

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