epg

package
v3.5.1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: CC-BY-4.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// URL for fetching channels from JioTV API
	CHANNEL_URL = "https://jiotv.data.cdn.jio.com/apis/v3.0/getMobileChannelList/get/?os=android&devicetype=phone&usertype=tvYR7NSNn7rymo3F"
	// URL for fetching EPG data for individual channels from JioTV API
	EPG_URL = "https://jiotv.data.cdn.jio.com/apis/v1.3/getepg/get/?offset=%d&channel_id=%d"
	// EPG_TASK_ID is the ID of the EPG generation task
	EPG_TASK_ID = "jiotv_epg"
)

Variables

This section is empty.

Functions

func GenXMLGz

func GenXMLGz(filename string) error

GenXMLGz generates XML EPG from JioTV API and writes it to a compressed gzip file.

func Init

func Init()

Init initializes EPG generation and schedules it for the next day.

Types

type Channel

type Channel struct {
	XMLName xml.Name `xml:"channel"`      // XML tag name
	ID      int      `xml:"id,attr"`      // ID is attribute of channel tag
	Display string   `xml:"display-name"` // Display name of the channel
}

Channel XML tag structure for the EPG

type ChannelObject

type ChannelObject struct {
	ChannelID   int    `json:"channel_id"`   // Channel ID
	ChannelName string `json:"channel_name"` // Channel name
	LogoURL     string `json:"logoUrl"`      // Channel logo URL
}

ChannelObject represents Individual channel detail from JioTV API response

type ChannelsResponse

type ChannelsResponse struct {
	Channels []ChannelObject `json:"result"`  // Channels
	Code     int             `json:"code"`    // Response code
	Message  string          `json:"message"` // Response message
}

ChannelsResponse represents Channel details from JioTV API response

type Desc

type Desc struct {
	XMLName xml.Name `xml:"desc"`
	Value   string   `xml:",chardata"` // Description of the programme
	Lang    string   `xml:"lang,attr"` // Language of the description
}

Desc represents Description XML tag for Programme XML tag in EPG

type EPG

type EPG struct {
	XMLName     xml.Name    `xml:"tv"`            // XML tag name
	XMLVersion  string      `xml:"version,attr"`  // XML version
	XMLEncoding string      `xml:"encoding,attr"` // XML encoding
	Channel     []Channel   `xml:"channel"`       // Channel tags
	Programme   []Programme `xml:"programme"`     // Programme tags
}

EPG XML tag structure

type EPGObject

type EPGObject struct {
	StartEpoch   EpochString `json:"startEpoch"`       // Start time of the programme
	EndEpoch     EpochString `json:"endEpoch"`         // End time of the programme
	ChannelID    uint16      `json:"channel_id"`       // Channel ID
	ChannelName  string      `json:"channel_name"`     // Channel name
	ShowCategory string      `json:"showCategory"`     // Category of the show
	Description  string      `json:"description"`      // Description of the show
	Title        string      `json:"showname"`         // Title of the show
	Thumbnail    string      `json:"episodeThumbnail"` // Thumbnail of the show
	Poster       string      `json:"episodePoster"`    // Poster of the show
}

EPGObject represents Individual EPG detail from JioTV EPG API response

type EPGResponse

type EPGResponse struct {
	EPG []EPGObject `json:"epg"` // EPG details for a channel
}

EPGResponse represents EPG details from JioTV EPG API response

type EpochString

type EpochString string

EpochString is a custom type for unmarshaling epoch from integers to strings in JioTV EPG API

func (*EpochString) String

func (id *EpochString) String() string

String returns the string representation of the EpochString

func (*EpochString) UnmarshalJSON

func (id *EpochString) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals epoch integers to strings from JioTV EPG API

type Icon

type Icon struct {
	XMLName xml.Name `xml:"icon"`     // XML tag name
	Src     string   `xml:"src,attr"` // Src is attribute of the icon tag
}

Icon XML tag for Programme XML tag in EPG

type Programme

type Programme struct {
	XMLName xml.Name `xml:"programme"`    // XML tag name
	Channel string   `xml:"channel,attr"` // Channel is attribute of programme tag
	Start   string   `xml:"start,attr"`   // Start time of the programme
	Stop    string   `xml:"stop,attr"`    // Stop time of the programme
	Title   Title    `xml:"title"`        // Title of the programme
	Desc    Desc     `xml:"desc"`         // Description of the programme
	Icon    Icon     `xml:"icon"`         // Icon of the programme
}

Programme XML tag structure for EPG Each programme tag represents a show being aired on a channel

func NewProgramme

func NewProgramme(channelID int, start, stop, title, desc, iconSrc string) Programme

NewProgramme creates a new Programme with the given parameters.

type Title

type Title struct {
	XMLName xml.Name `xml:"title"`
	Value   string   `xml:",chardata"` // Title of the programme
	Lang    string   `xml:"lang,attr"` // Language of the title
}

Title XML tag for Programme XML tag in EPG Title is the name of the programme or show being aired on the channel

Jump to

Keyboard shortcuts

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