Documentation
¶
Overview ¶
Package cair provides a client to version 24.1 of the Cinegy Air HTTP API as documented at https://open.cinegy.com/products/air/24.1/cinegy-air-http-api/.
Typical usage starts with creating a Client, then fetching the current playlist by calling Playlist on Client. For example, to print the names of all future items that are 3 minutes or less (e.g. station breaks):
client := &Client{http.DefaultClient, "http://air.example.com:5521")
playlist, err := client.Playlist("video")
if err != nil {
// handle error...
}
for _, it := range playlist.Items {
if it.ScheduledAt.Before(time.Now()) {
continue
}
if it.Duration <= 3*time.Minute {
fmt.Println(it.Name)
}
}
Index ¶
Constants ¶
View Source
const DefaultPort = 5521
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
*http.Client // http.DefaultClient if nil.
// Root is a HTTP URL pointing to the root from the Air API is served.
// If empty the client assumes the value "http://127.0.0.1:5521".
Root string
}
Client is used to communicate with the Cinegy Air API.
type Item ¶
type Item struct {
ID string `xml:"Id,attr"`
Name string `xml:",attr"`
Description string `xml:",attr"`
ThirdPartyId string `xml:",attr"`
SubtitleId string `xml:",attr"`
EPGID string `xml:"EpgId,attr"`
ProxyProgress string `xml:",attr"`
ScheduledAt time.Time `xml:",attr"`
Duration time.Duration `xml:",attr"`
OutOfNetwork string `xml:",attr"`
}
func (*Item) EndTime ¶
EndTime calculates the time i should end by inspecting its start time and duration.
func (*Item) UnmarshalXML ¶
Click to show internal directories.
Click to hide internal directories.