api

package
v0.0.0-...-17097b9 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2016 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseURL      = "http://xml.oztivo.net/xmltv/"
	DataListFile = BaseURL + "datalist.xml.gz"
)

Variables

View Source
var (
	ResponseLimit int = 500
)

Functions

func ChannelHandler

func ChannelHandler(w http.ResponseWriter, r *http.Request, params martini.Params)

Handle HTTP requests for channels

func InitAPI

func InitAPI(userAgentIn string)

func ProgrammeHandler

func ProgrammeHandler(w http.ResponseWriter, r *http.Request, params martini.Params)

Handle HTTP requests for programmes

Types

type APIResponse

type APIResponse struct {
	Error string      `json:"error,omitempty"`
	Data  interface{} `json:"data,omitempty"`
}

type Channel

type Channel struct {
	Id          string `xml:"id,attr" json:"id"`
	DisplayName struct {
		Text string `xml:",innerxml" json:"text"`
		Lang string `xml:"lang,attr" json:"lang"`
	} `xml:"display-name" json:"display_name"`
	BaseURL  []string `xml:"base-url" json:"-"`
	DataFor  []string `xml:"datafor" json:"-"`
	DataForT TimeList `xml:"-" json:"-"`
}

type ChannelDay

type ChannelDay struct {
	ChannelId  string       `xml:"-" json:"id"`
	Date       time.Time    `xml:"-" json:"date"`
	Programmes []*Programme `xml:"programme" json:"programme"`
}

type ChannelRequest

type ChannelRequest struct {
	// If empty, return all channels
	ChannelName string `json:"channel_name"`
	// If true, match anything containing the name (case insensitive)
	Contains bool `json:"contains"`
}

type DataList

type DataList struct {
	Channels []*Channel `xml:"channel"`
	// Maps channel id to channel
	ChannelMap map[string]*Channel `xml:"-"`
	Mutex      *sync.Mutex
}

type Programme

type Programme struct {
	StartTime   string    `xml:"start,attr" json:"-"`
	StopTime    string    `xml:"stop,attr" json:"-"`
	StartTimeJ  time.Time `xml:"-" json:"start_time"`
	StopTimeJ   time.Time `xml:"-" json:"stop_time"`
	Title       string    `xml:"title" json:"title"`
	SubTitle    string    `xml:"sub-title" json:"subtitle"`
	Description string    `xml:"desc" json:"description"`
	Credits     []struct {
		Actor string `xml:"actor" json:"actor,omitempty"`
	} `xml:"credits" json:"credits,omitempty"`
	Category []string `xml:"category" json:"category,omitempty"`
	Rating   []struct {
		Value string `xml:"value" json:"value,omitempty"`
	} `xml:"rating" json:"rating,omitempty"`
	StarRating []struct {
		Value string `xml:"value" json:"value,omitempty"`
	} `xml:"star-rating" json:"star_rating,omitempty"`
}

type ProgrammeRequest

type ProgrammeRequest struct {
	// JSON date string as output by Date.toJSON()
	// e.g. 2012-04-23T18:25:43.511Z
	Days []time.Time `json:"days"`

	// Channel ID string
	Channels []string `json:"channels"`
}

type TimeList

type TimeList []time.Time

Jump to

Keyboard shortcuts

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