Channels
The Channels module lets you manage lists of Channels.
Lists
Channels are organized in Lists. Lists are either "automatic" or "custom". Automatic lists are managed by the platform and Custom lists are managed by the user.
The Master List
The Master List is a special Automatic List. It contains all Channels that the platform knows about. The Master List's id is always 0, and its name is an empty string.
When you start a scan, channels that are not already in the Master List will be added. If you want to replace all channels instead, call clear before scanning.
Members
onServicesChanged
Signal fired when the channel line-up has changed. (due to scanning/addition/deletion/move of channels)
onStreamsChanged
Signal fired when the properties of a service stream are updated (i.e. name, lcn etc.). The listener will be passed the following arguments:
- dvbUrl: The dvb url (dvb://nid.tid.sid) object that produced this Signal .
ServiceType
Enum for the supported service types.
Properties:
| Name | Type | Description |
|---|---|---|
UNDEFINED | Display for the default time (TV dependent) | |
TV | Display until cleared | |
RADIO | Clear the last message displayed | |
DATA | Clear the last message displayed |
Methods
clear()
Empty the Master List.
Returns:
| Type | Description |
|---|---|
| A promise. | No arguments are passed to the completion handler. |
clearChannels(mrls)
Remove multiple channels by mrl from the DVB database.
Parameters::
| Name | Type | Description |
|---|---|---|
mrls | Array | An Array of strings containing the mrls of the channels to be removed. |
Returns:
| Type | Description |
|---|---|
| A promise. | The completion handler will be passed the following arguments: - count: The number of the successfully removed channels. |
export()
Export channels from the Master List to an XML representation.
Returns:
| Type | Description |
|---|---|
| A promise. | The completion handler will be passed the following arguments: - xml: A string contaning the XML representation of the channel database. |
getChannelInfo(mrl)
Get an entire Channel Object.
Parameters:
| Name | Type | Description |
|---|---|---|
mrl | MRL | The Channel's MRL. |
Returns:
| Type | Description |
|---|---|
| A promise. | The completion handler will be passed the following arguments: - channel: A complete decription of a Channel. |
getChannels(list_id, filter)
Returns a List's channels. Passing null for filter will return all elements.
Parameters:
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
list_id | ID | The List's id. | |||||||||
filter | Object | A filter for the returned Array. Properties:
|
Returns:
| Type | Description |
|---|---|
| A promise. | The completion handler will be passed the following arguments: - channels: An Array of Channels. |
getListInfo(list_id)
Get an entire List Object.
Parameters:
| Name | Type | Description |
|---|---|---|
list_id | ID | The id of the List. |
Returns:
| Type | Description |
|---|---|
| A promise. | The completion handler will be passed the following arguments: - list: The entire List description. |
getLists(template)
Get all Lists.
Parameters:
| Name | Type | Description |
|---|---|---|
template | Template | A template for the returned Array. |
Returns:
| Type | Description |
|---|---|
| A promise. | The completion handler will be passed the following arguments: - lists: An Array of Lists, populated as per the template. |
import(xml)
Import channels from an XML representation.
Parameters:
| Name | Type | Description |
|---|---|---|
xml | String | A string contaning the XML representation of the channel database. |
Returns:
| Type | Description |
|---|---|
| A promise. | No arguments are passed to the completion handler. |
Type Defintions
Channel
This structure represents a DVB service. Channels created by Scanner will be of this type.
Properties:
| Name | Type | Description |
|---|---|---|
| mrl | MRL | The Channel's MRL. |
| name | String | The Channel's name. |
| service_type | module:Platform.Channels.ServiceType | The service type of the Channel. |
| onid | Number | The ONID (Original Network ID) of the channel. |
| tsid | Number | The TSID (Transport Stream ID) of te channel. |
| sid | Number | The SID (Service ID) of the channel. |
| full_name | String | The full name of the Channel. |
| short_name | String | The short name of the Channel. |
| lcn | Number | The LCN (Logical Channel Desctiption) of the Channel. |
| locked | Boolean | Indicates whether the channel is locked or not. |
| unavailable | Boolean | Indicates whether the channel is available or not. |
| not_running | Boolean | Indicates whether the channel is running or not. |
| recent | Boolean | Indicates whether the channel was descovered recently. |
| scrambled | Boolean | Indicates whether the channel is scrambled or not. |
List
This structure represents a List. The list's Channels are not part of ths description. They can be queried seperately using getChannels.
Properties:
| Name | Type | Description |
|---|---|---|
| id | ID | The List's unique identifier. |
| name | String | The List's name. |
| auto | Boolean | Will be true if this is an automatic list. |