guideproviders

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: 10 Imported by: 0

Documentation

Overview

Package guideproviders is a telly internal package to provide electronic program guide (EPG) data. It is generally modeled after the XMLTV standard with slight deviations to accommodate other providers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AvailableLineup

type AvailableLineup struct {
	Location   string
	Transport  string
	Name       string
	ProviderID string
}

AvailableLineup is a lineup that a user can subscribe to.

type Channel

type Channel struct {
	// Required Fields
	ID     string `json:",omitempty"`
	Name   string `json:",omitempty"`
	Logos  []Logo `json:",omitempty"`
	Number string `json:",omitempty"`

	// Optional fields
	CallSign  string   `json:",omitempty"`
	URLs      []string `json:",omitempty"`
	Lineup    string   `json:",omitempty"`
	Affiliate string   `json:",omitempty"`

	ProviderData interface{} `json:",omitempty"`
}

Channel describes a channel available in the providers lineup with necessary pieces parsed into fields.

func (*Channel) XMLTV

func (c *Channel) XMLTV() xmltv.Channel

XMLTV returns the xmltv.Channel representation of the Channel.

type Configuration

type Configuration struct {
	Name     string `json:"-"`
	Provider string

	// Only used for Schedules Direct provider
	Username string
	Password string
	Lineups  []string

	// Only used for XMLTV provider
	XMLTVURL string
}

Configuration is the basic configuration struct for guideproviders with generic values for specific providers.

func (*Configuration) GetProvider

func (i *Configuration) GetProvider() (GuideProvider, error)

GetProvider returns an initialized GuideProvider for the Configuration.

type CoverageArea

type CoverageArea struct {
	RegionName        string `json:",omitempty"`
	FullName          string `json:",omitempty"`
	PostalCode        string `json:",omitempty"`
	PostalCodeExample string `json:",omitempty"`
	ShortName         string `json:",omitempty"`
	OnePostalCode     bool   `json:",omitempty"`
}

CoverageArea describes a region that a provider supports.

type GuideProvider

type GuideProvider interface {
	Name() string
	Channels() ([]Channel, error)
	Schedule(daysToGet int, inputChannels []Channel, inputProgrammes []ProgrammeContainer) (map[string]interface{}, []ProgrammeContainer, error)

	Refresh(lastStatusJSON *json.RawMessage) ([]byte, error)
	Configuration() Configuration

	// Schedules Direct specific functions that others might someday use.
	SupportsLineups() bool
	LineupCoverage() ([]CoverageArea, error)
	AvailableLineups(countryCode, postalCode string) ([]AvailableLineup, error)
	PreviewLineupChannels(lineupID string) ([]Channel, error)
	SubscribeToLineup(lineupID string) (interface{}, error)
	UnsubscribeFromLineup(providerID string) error
}

GuideProvider describes a IPTV provider configuration.

type Logo struct {
	URL    string `json:"URL"`
	Height int    `json:"height"`
	Width  int    `json:"width"`
}

A Logo stores the information about a channel logo

type ProgrammeContainer

type ProgrammeContainer struct {
	Programme    xmltv.Programme
	ProviderData interface{}
}

ProgrammeContainer contains information about a single provider in the XMLTV format as well as provider specific data.

type SchedulesDirect

type SchedulesDirect struct {
	BaseConfig Configuration
	// contains filtered or unexported fields
}

SchedulesDirect is a GuideProvider supporting the Schedules Direct JSON service.

func (*SchedulesDirect) AvailableLineups

func (s *SchedulesDirect) AvailableLineups(countryCode, postalCode string) ([]AvailableLineup, error)

AvailableLineups will return a slice of AvailableLineup for the given countryCode and postalCode.

func (*SchedulesDirect) Channels

func (s *SchedulesDirect) Channels() ([]Channel, error)

Channels returns a slice of Channel that the provider has available.

func (*SchedulesDirect) Configuration

func (s *SchedulesDirect) Configuration() Configuration

Configuration returns the base configuration backing the provider.

func (*SchedulesDirect) LineupCoverage

func (s *SchedulesDirect) LineupCoverage() ([]CoverageArea, error)

LineupCoverage returns a map of regions and countries the provider has support for.

func (*SchedulesDirect) Name

func (s *SchedulesDirect) Name() string

Name returns the name of the GuideProvider.

func (*SchedulesDirect) PreviewLineupChannels

func (s *SchedulesDirect) PreviewLineupChannels(lineupID string) ([]Channel, error)

PreviewLineupChannels will return a slice of Channels for the given provider specific lineupID.

func (*SchedulesDirect) Refresh

func (s *SchedulesDirect) Refresh(lastStatusJSON *json.RawMessage) ([]byte, error)

Refresh causes the provider to request the latest information.

func (*SchedulesDirect) Schedule

func (s *SchedulesDirect) Schedule(daysToGet int, inputChannels []Channel, inputProgrammes []ProgrammeContainer) (map[string]interface{}, []ProgrammeContainer, error)

Schedule returns a slice of xmltv.Programme for the given channelIDs.

func (*SchedulesDirect) SubscribeToLineup

func (s *SchedulesDirect) SubscribeToLineup(lineupID string) (interface{}, error)

SubscribeToLineup will subscribe the user to a lineup.

func (*SchedulesDirect) SupportsLineups

func (s *SchedulesDirect) SupportsLineups() bool

SupportsLineups returns true if the provider supports the concept of subscribing to lineups.

func (*SchedulesDirect) UnsubscribeFromLineup

func (s *SchedulesDirect) UnsubscribeFromLineup(lineupID string) error

UnsubscribeFromLineup will remove a lineup from the provider account.

type XMLTV

type XMLTV struct {
	BaseConfig Configuration
	// contains filtered or unexported fields
}

XMLTV is a GuideProvider supporting XMLTV files.

func (*XMLTV) AvailableLineups

func (x *XMLTV) AvailableLineups(countryCode, postalCode string) ([]AvailableLineup, error)

AvailableLineups will return a slice of AvailableLineup for the given countryCode and postalCode.

func (*XMLTV) Channels

func (x *XMLTV) Channels() ([]Channel, error)

Channels returns a slice of Channel that the provider has available.

func (*XMLTV) Configuration

func (x *XMLTV) Configuration() Configuration

Configuration returns the base configuration backing the provider

func (*XMLTV) LineupCoverage

func (x *XMLTV) LineupCoverage() ([]CoverageArea, error)

LineupCoverage returns a map of regions and countries the provider has support for.

func (*XMLTV) Name

func (x *XMLTV) Name() string

Name returns the name of the GuideProvider.

func (*XMLTV) PreviewLineupChannels

func (x *XMLTV) PreviewLineupChannels(lineupID string) ([]Channel, error)

PreviewLineupChannels will return a slice of Channels for the given provider specific lineupID.

func (*XMLTV) Refresh

func (x *XMLTV) Refresh(lastStatusJSON *json.RawMessage) ([]byte, error)

Refresh causes the provider to request the latest information.

func (*XMLTV) Schedule

func (x *XMLTV) Schedule(daysToGet int, inputChannels []Channel, inputProgrammes []ProgrammeContainer) (map[string]interface{}, []ProgrammeContainer, error)

Schedule returns a slice of xmltv.Programme for the given channelIDs.

func (*XMLTV) SubscribeToLineup

func (x *XMLTV) SubscribeToLineup(lineupID string) (interface{}, error)

SubscribeToLineup will subscribe the user to a lineup.

func (*XMLTV) SupportsLineups

func (x *XMLTV) SupportsLineups() bool

SupportsLineups returns true if the provider supports the concept of subscribing to lineups.

func (*XMLTV) UnsubscribeFromLineup

func (x *XMLTV) UnsubscribeFromLineup(providerID string) error

UnsubscribeFromLineup will remove a lineup from the provider account.

Jump to

Keyboard shortcuts

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