xmltv

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package xmltv provides structures for parsing XMLTV data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

type Actor struct {
	Role  string `xml:"role,attr,omitempty" json:"role,omitempty" db:"role,omitempty"`
	Value string `xml:",chardata"           json:"value"          db:"value"`
}

Actor in a programme

type Audio

type Audio struct {
	Present string `xml:"present,omitempty" json:"present,omitempty" db:"present,omitempty"`
	Stereo  string `xml:"stereo,omitempty"  json:"stereo,omitempty"  db:"stereo,omitempty"`
}

Audio details of the programme

type Channel

type Channel struct {
	XMLName      xml.Name        `xml:"channel"        json:"-"               db:"-"`
	DisplayNames []CommonElement `xml:"display-name"   json:"displayNames"    db:"display_names"`
	Icons        []Icon          `xml:"icon,omitempty" json:"icons,omitempty" db:"icons,omitempty"`
	URLs         []string        `xml:"url,omitempty"  json:"urls,omitempty"  db:"urls,omitempty"`
	ID           string          `xml:"id,attr"        json:"id,omitempty"    db:"id,omitempty"`
	LCN          string          `xml:"lcn"            json:"lcn,omitempty"   db:"lcn,omitempty"` // LCN is the local channel number. Plex will show it in place of the channel ID if it exists.
}

Channel details of a channel

type CommonElement

type CommonElement struct {
	Lang  string `xml:"lang,attr,omitempty" json:"lang,omitempty"  db:"lang,omitempty" `
	Value string `xml:",chardata"           json:"value,omitempty" db:"value,omitempty"`
}

CommonElement element structure that is common, i.e. <country lang="en">Italy</country>

type Credits

type Credits struct {
	Directors    []string `xml:"director,omitempty"    json:"directors,omitempty"    db:"directors,omitempty"`
	Actors       []Actor  `xml:"actor,omitempty"       json:"actors,omitempty"       db:"actors,omitempty"`
	Writers      []string `xml:"writer,omitempty"      json:"writers,omitempty"      db:"writers,omitempty"`
	Adapters     []string `xml:"adapter,omitempty"     json:"adapters,omitempty"     db:"adapters,omitempty"`
	Producers    []string `xml:"producer,omitempty"    json:"producers,omitempty"    db:"producers,omitempty"`
	Composers    []string `xml:"composer,omitempty"    json:"composers,omitempty"    db:"composers,omitempty"`
	Editors      []string `xml:"editor,omitempty"      json:"editors,omitempty"      db:"editors,omitempty"`
	Presenters   []string `xml:"presenter,omitempty"   json:"presenters,omitempty"   db:"presenters,omitempty"`
	Commentators []string `xml:"commentator,omitempty" json:"commentators,omitempty" db:"commentators,omitempty"`
	Guests       []string `xml:"guest,omitempty"       json:"guests,omitempty"       db:"guests,omitempty"`
}

Credits for the programme

type Date

type Date time.Time

Date is the XMLTV specific formatting of a date (YYYYMMDD/20060102)

func (Date) MarshalJSON

func (p Date) MarshalJSON() ([]byte, error)

MarshalJSON is used to marshal a Go time.Time into the XMLTV Date Format.

func (Date) MarshalXML

func (p Date) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML is used to marshal a Go time.Time into the XMLTV Date Format.

func (*Date) UnmarshalJSON

func (p *Date) UnmarshalJSON(text []byte) (err error)

UnmarshalJSON is used to unmarshal a time in the XMLTV Date format to a time.Time.

func (*Date) UnmarshalXML

func (p *Date) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)

UnmarshalXML is used to unmarshal a time in the XMLTV Date format to a time.Time.

type ElementPresent

type ElementPresent bool

ElementPresent used to determine if element is present or not

func (*ElementPresent) MarshalXML

func (c *ElementPresent) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML used to determine if the element is present or not. see https://stackoverflow.com/a/46516243

func (*ElementPresent) UnmarshalXML

func (c *ElementPresent) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML used to determine if the element is present or not. see https://stackoverflow.com/a/46516243

type EpisodeNum

type EpisodeNum struct {
	System string `xml:"system,attr,omitempty" json:"system,omitempty" db:"system,omitempty"`
	Value  string `xml:",chardata"             json:"value"            db:"value"`
}

EpisodeNum of the programme

type Icon

type Icon struct {
	Source string `xml:"src,attr"              json:"source"           db:"source"`
	Width  int    `xml:"width,attr,omitempty"  json:"width,omitempty"  db:"width,omitempty"`
	Height int    `xml:"height,attr,omitempty" json:"height,omitempty" db:"height,omitempty"`
}

Icon associated with the element that contains it

type Length

type Length struct {
	Units string `xml:"units,attr" json:"units" db:"units"`
	Value string `xml:",chardata"  json:"value" db:"value"`
}

Length of the programme

type PreviouslyShown

type PreviouslyShown struct {
	Start   Time   `xml:"start,attr,omitempty"   json:"start,omitempty"   db:"start,omitempty"`
	Channel string `xml:"channel,attr,omitempty" json:"channel,omitempty" db:"channel,omitempty"`
}

PreviouslyShown When and where the programme was last shown, if known.

type Programme

type Programme struct {
	XMLName         xml.Name         `xml:"programme"                  json:"-"                          db:"-"`
	ID              string           `xml:"id,attr,omitempty"          json:"id,omitempty"               db:"id,omitempty"` // not defined by standard, but often present
	Titles          []CommonElement  `xml:"title"                      json:"titles"                     db:"titles"`
	SecondaryTitles []CommonElement  `xml:"sub-title,omitempty"        json:"secondaryTitles,omitempty"  db:"secondary_titles,omitempty"`
	Descriptions    []CommonElement  `xml:"desc,omitempty"             json:"descriptions,omitempty"     db:"descriptions,omitempty"`
	Credits         *Credits         `xml:"credits,omitempty"          json:"credits,omitempty"          db:"credits,omitempty"`
	Date            Date             `xml:"date,omitempty"             json:"date,omitempty"             db:"date,omitempty"`
	Categories      []CommonElement  `xml:"category,omitempty"         json:"categories,omitempty"       db:"categories,omitempty"`
	Keywords        []CommonElement  `xml:"keyword,omitempty"          json:"keywords,omitempty"         db:"keywords,omitempty"`
	Languages       []CommonElement  `xml:"language,omitempty"         json:"languages,omitempty"        db:"languages,omitempty"`
	OrigLanguages   []CommonElement  `xml:"orig-language,omitempty"    json:"origLanguages,omitempty"    db:"orig_languages,omitempty"`
	Length          *Length          `xml:"length,omitempty"           json:"length,omitempty"           db:"length,omitempty"`
	Icons           []Icon           `xml:"icon,omitempty"             json:"icons,omitempty"            db:"icons,omitempty"`
	URLs            []string         `xml:"url,omitempty"              json:"urls,omitempty"             db:"urls,omitempty"`
	Countries       []CommonElement  `xml:"country,omitempty"          json:"countries,omitempty"        db:"countries,omitempty"`
	EpisodeNums     []EpisodeNum     `xml:"episode-num,omitempty"      json:"episodeNums,omitempty"      db:"episode_nums,omitempty"`
	Video           *Video           `xml:"video,omitempty"            json:"video,omitempty"            db:"video,omitempty"`
	Audio           *Audio           `xml:"audio,omitempty"            json:"audio,omitempty"            db:"audio,omitempty"`
	PreviouslyShown *PreviouslyShown `xml:"previously-shown,omitempty" json:"previouslyShown,omitempty"  db:"previously_shown,omitempty"`
	Premiere        *CommonElement   `xml:"premiere,omitempty"         json:"premiere,omitempty"         db:"premiere,omitempty"`
	LastChance      *CommonElement   `xml:"last-chance,omitempty"      json:"lastChance,omitempty"       db:"last_chance,omitempty"`
	New             *ElementPresent  `xml:"new"                        json:"new,omitempty"              db:"new,omitempty"`
	Subtitles       []Subtitle       `xml:"subtitles,omitempty"        json:"subtitles,omitempty"        db:"subtitles,omitempty"`
	Ratings         []Rating         `xml:"rating,omitempty"           json:"ratings,omitempty"          db:"ratings,omitempty"`
	StarRatings     []Rating         `xml:"star-rating,omitempty"      json:"starRatings,omitempty"      db:"star_ratings,omitempty"`
	Reviews         []Review         `xml:"review,omitempty"           json:"reviews,omitempty"          db:"reviews,omitempty"`
	Start           *Time            `xml:"start,attr"                 json:"start"                      db:"start"`
	Stop            *Time            `xml:"stop,attr,omitempty"        json:"stop,omitempty"             db:"stop,omitempty"`
	PDCStart        *Time            `xml:"pdc-start,attr,omitempty"   json:"pdcStart,omitempty"         db:"pdc_start,omitempty"`
	VPSStart        *Time            `xml:"vps-start,attr,omitempty"   json:"vpsStart,omitempty"         db:"vps_start,omitempty"`
	Showview        string           `xml:"showview,attr,omitempty"    json:"showview,omitempty"         db:"showview,omitempty"`
	Videoplus       string           `xml:"videoplus,attr,omitempty"   json:"videoplus,omitempty"        db:"videoplus,omitempty"`
	Channel         string           `xml:"channel,attr"               json:"channel"                    db:"channel"`
	Clumpidx        string           `xml:"clumpidx,attr,omitempty"    json:"clumpidx,omitempty"         db:"clumpidx,omitempty"`
}

Programme details of a single programme transmission

type Rating

type Rating struct {
	Value  string `xml:"value"                 json:"value"            db:"value"`
	Icons  []Icon `xml:"icon,omitempty"        json:"icons,omitempty"  db:"icons,omitempty"`
	System string `xml:"system,attr,omitempty" json:"system,omitempty" db:"system,omitempty"`
}

Rating of a programme

type Review

type Review struct {
	Value    string `xml:",chardata"          json:"value"              db:"value"`
	Type     string `xml:"type"               json:"type"               db:"type"`
	Source   string `xml:"source,omitempty"   json:"source,omitempty"   db:"source,omitempty"`
	Reviewer string `xml:"reviewer,omitempty" json:"reviewer,omitempty" db:"reviewer,omitempty"`
	Lang     string `xml:"lang,omitempty"     json:"lang,omitempty"     db:"lang,omitempty"`
}

Review of a programme

type Subtitle

type Subtitle struct {
	Language *CommonElement `xml:"language,omitempty"  json:"language,omitempty" db:"language,omitempty"`
	Type     string         `xml:"type,attr,omitempty" json:"type,omitempty"     db:"type,omitempty"`
}

Subtitle in a programme

type TV

type TV struct {
	XMLName           xml.Name    `xml:"tv"                                 json:"-"                             db:"-"`
	Channels          []Channel   `xml:"channel"                            json:"channels"                      db:"channels"`
	Programmes        []Programme `xml:"programme"                          json:"programmes"                    db:"programmes"`
	Date              string      `xml:"date,attr,omitempty"                json:"date,omitempty"                db:"date,omitempty"`
	SourceInfoURL     string      `xml:"source-info-url,attr,omitempty"     json:"sourceInfoURL,omitempty"       db:"source_info_url,omitempty"`
	SourceInfoName    string      `xml:"source-info-name,attr,omitempty"    json:"sourceInfoName,omitempty"      db:"source_info_name,omitempty"`
	SourceDataURL     string      `xml:"source-data-url,attr,omitempty"     json:"sourceDataURL,omitempty"       db:"source_data_url,omitempty"`
	GeneratorInfoName string      `xml:"generator-info-name,attr,omitempty" json:"generatorInfoName,omitempty"   db:"generator_info_name,omitempty"`
	GeneratorInfoURL  string      `xml:"generator-info-url,attr,omitempty"  json:"generatorInfoURL,omitempty"    db:"generator_info_url,omitempty"`
}

TV is the root element.

func (*TV) LoadXML

func (t *TV) LoadXML(f io.Reader) error

LoadXML loads the XMLTV XML from file.

type Time

type Time struct {
	time.Time
}

Time that holds the time which is parsed from XML

func (*Time) MarshalXMLAttr

func (t *Time) MarshalXMLAttr(name xml.Name) (xml.Attr, error)

MarshalXMLAttr is used to marshal a Go time.Time into the XMLTV Format.

func (*Time) UnmarshalXMLAttr

func (t *Time) UnmarshalXMLAttr(attr xml.Attr) error

UnmarshalXMLAttr is used to unmarshal a time in the XMLTV format to a time.Time.

type Video

type Video struct {
	Present string `xml:"present,omitempty" json:"present,omitempty" db:"present,omitempty"`
	Colour  string `xml:"colour,omitempty"  json:"colour,omitempty"  db:"colour,omitempty"`
	Aspect  string `xml:"aspect,omitempty"  json:"aspect,omitempty"  db:"aspect,omitempty"`
	Quality string `xml:"quality,omitempty" json:"quality,omitempty" db:"quality,omitempty"`
}

Video details of the programme

Jump to

Keyboard shortcuts

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