xmltv

package
v0.0.0-...-71f244b Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DocType    = "<!DOCTYPE tv SYSTEM \"xmltv.dtd\">\n"
	TimeLayout = "20060102150405 -0700"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	Id           string          `xml:"id,attr"`
	DisplayNames []LocalizedText `xml:"display-name"`
	Icons        []ChannelIcon   `xml:"icon"`
}

type ChannelIcon

type ChannelIcon struct {
	Src    string `xml:"src,attr"`
	Width  int    `xml:"width,attr"`
	Height int    `xml:"height,attr"`
}

type LocalizedText

type LocalizedText struct {
	Lang string `xml:"lang,attr,omitempty"`
	Data string `xml:",chardata"`
}

func NewText

func NewText(lang, data string) LocalizedText

type Program

type Program struct {
	ChannelNames []LocalizedText // channel name from crawler
	Items        []Programme
}

func NewProgram

func NewProgram(names ...LocalizedText) *Program

func (*Program) AddItems

func (p *Program) AddItems(items []Programme)

type Programme

type Programme struct {
	Start        Timestamp       `xml:"start,attr"`
	Stop         Timestamp       `xml:"stop,attr"`
	Channel      string          `xml:"channel,attr"`
	Title        LocalizedText   `xml:"title"`
	Descriptions []LocalizedText `xml:"desc,omitempty"`
}

func NewProgramme

func NewProgramme(start, stop time.Time, title string) Programme

type Timestamp

type Timestamp time.Time

func (Timestamp) MarshalXMLAttr

func (ts Timestamp) MarshalXMLAttr(name xml.Name) (xml.Attr, error)

type XmlTv

type XmlTv struct {
	XMLName           string      `xml:"tv"`
	SourceInfoUrl     string      `xml:"source-info-url,attr,omitempty"`
	SourceInfoName    string      `xml:"source-info-name,attr,omitempty"`
	GeneratorInfoName string      `xml:"generator-info-name,attr,omitempty"`
	GeneratorInfoUrl  string      `xml:"generator-info-url,attr,omitempty"`
	Channels          []Channel   `xml:"channel"`
	Programmes        []Programme `xml:"programme"`
}

func NewXml

func NewXml() *XmlTv

func (*XmlTv) AddProgram

func (t *XmlTv) AddProgram(id, name string, program *Program)

func (*XmlTv) Save

func (t *XmlTv) Save(name string) error

Jump to

Keyboard shortcuts

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