# Implementing EPG feeds

## Introduction

You'll need to implement two feed types to support EPG.
The first feed will hold the list of available EPG channels,
the second will hold the available programs on that channel.

## The Channels feed

The channels feed holds the list of available channels.
Our EPG implementation supports multi channel EPG. 
Using the `Channels feed` you can list all your available channels.
Later, in the `Channel feed`, we'll use the channel `id` to retrieve
the programs of that specific channel.

For each channel you'll need to set the channel logo image.
You should use a transparent 192x144 pixels png image.

```json

{
	"id": "channels",
	"type": {
		"value": "epg-channels"
	},
	"entry": [
	  {
		"id":"<UNIQUE_CHANNEL_ID>",
		"type": {
			"value": "epg-channel"
		},
		"title": "<CHANNEL_NAME>",
		"media_group": [
			{
          "type": "image",
          "media_item": [
            {
              "src": "<URL_TO_CHANNEL_LOGO_PNG_FILE>",
              "key": "image_base",
            },
          ]
        },
		]
	  }
	]
}
```
 

## The Channel programs feed

The `Channel programs` feed holds the upcoming programs of the current channel.
When constructing the URL of the feed, the channel id should be passed as
a parameter e.g. `https://example.com/programs?channel={{channelId}}`.

The EPG screen will add to this URL a `start_time` query param that will hold the value (in ISO 8601 format) from which the server should return the programs.
You should return all programs from the start time till the end of the `start_time` day.

```json
{
	"id": "<UNIQUE_CHANNEL_ID>",
	"type": {
		"value": "epg-channel-programs"
	},
	"entry": [
		{
			"id": "<UNIQUE_PROGRAM_ID>",
			"type": {
				"value": "epg-program"
			},
			"media_group": [{
              "type": "image",
              "media_item": [{
                "src": "<URL_TO_PROGRAM_PNG_FILE>",
                "key": "<IMAGE_KEY>",
            }]
      }],
			"extensions": {
				"start_time": "<DATE_TIME_ISO_8601>",
				"end_time": "<DATE_TIME_ISO_8601>"
			}
		}
	]
}
```

### Notes

- Programs should be ordered by start_time.
- You should only return programs form `start_time` till the end of the `start_time` day.
- An entry can hold content to hold the video stream if needed.
- The feed can hold any other field or extension.
