• Quick Start
  • Booting
  • Platform
  • Portals
  • References
    • API Reference TOI3
    • IIP Reference
  • Resources
ARRIS Enterprises, Inc. Confidential Information

ToiContentService

Class Summary

Extends:
  • ToiEventTarget

The Content Service interface provides access to searchable content sources both locally and in the network.

Service:

This is a service and can be accessed through toi.contentService
  • Methods
  • Members
  • Types
  • Events
  • Constants

Method Summary

createRecordedContentSourceInstance ( sourceId )  → ToiRecordedContentSource

Returns a source instance for recorded content.

getContent ( callbacks , parameters )  → operation

Starts a best effort request for getting additional content information. Even if not all content information can be retrieved (e.g. content may not be available anymore) the operation will be set to completed. Any resulting ToiContentService.ToiContentInfo information will only include property values for the requested properties.

getSources ( )  → Array.<ToiContentService.ToiSourceInfo>

Returns information about all available content sources.

remove ( callbacks , contentIds )  → operation

Removes the corresponding content for the given content identifiers.

removeProperties ( callbacks , contentIds , propertyIds )  → operation

Remove properties for the given content.

search ( callbacks , parameters )  → operation

Starts a search with the given condition. If multiple sources are included in the search, each source will only use the restrictions and properties it supports. The resulting ToiContentService.ToiContentInfo matches will only include property values for the requested properties.

setProperties ( callbacks , contentIds , properties )  → operation

Sets properties for the given content.

Inherited Methods

addEventListener ( type , listener )

This method registers an event listener for a specific event. Multiple listeners can be added for the same event. Events are broadcast to all registered listeners.

removeEventListener ( type , listener )

This method removes an event listener for a specific event.

Type Definitions

ToiConditionMap (Type: Object.<id1:restrictions1, id2:restrictions2, etc>)

Map of conditions (ToiContentService.ToiCondition) needed for a match. Map containing ToiContentService.ToiCondition.

ToiContentId (Type: string)

Identifier that uniquely identifies some content.

ToiContentType (Type: enum)

Identifies different types of content.

  • CONTENT_TYPE_AUDIO
  • CONTENT_TYPE_IMAGE
  • CONTENT_TYPE_VIDEO
ToiPropertyId (Type: string)

Identifier for a metadata property.

ToiPropertyMap (Type: Object.<id1:value1, id2:value2, etc>)

Map of properties (ToiContentService.ToiProperty). Map containing ToiContentService.ToiProperty.

ToiPropertyType (Type: enum)

Different kind of property value types to indicate how to interpret property values when doing comparisons and sorting.

  • PROPERTY_TYPE_BOOLEAN
  • PROPERTY_TYPE_DATE
  • PROPERTY_TYPE_INTEGER
  • PROPERTY_TYPE_STRING
ToiSourceId (Type: string)

Unique identifier of a source where searchable content exists.

ToiSourceType (Type: string)

Type of content source

Events

  • ON_SOURCE_AVAILABLE
  • ON_SOURCE_UNAVAILABLE

Constants

  • CONTENT_SOURCE_TYPE_DVR
  • PROPERTY_CONTENT_BROKEN
  • PROPERTY_CONTENT_DESCRIPTION
  • PROPERTY_CONTENT_DURATION
  • PROPERTY_CONTENT_FILESIZE
  • PROPERTY_CONTENT_LONGDESCRIPTION
  • PROPERTY_CONTENT_LOST_AND_FOUND
  • PROPERTY_CONTENT_TIMESTAMP
  • PROPERTY_CONTENT_TITLE
  • PROPERTY_CONTENT_TYPE
  • PROPERTY_CONTENT_URI
  • PROPERTY_SOURCE_MAX_LIMIT

Methods

addEventListener ( type , listener )

This method registers an event listener for a specific event. Multiple listeners can be added for the same event. Events are broadcast to all registered listeners.

Inherited From:

  • ToiEventTarget#addEventListener

Parameters:

Name Type Description
type number

The event type of the event to subscribe to.

listener ToiEventListener

The JavaScript function that will receive events.

Throws:

ToiInvalidArgumentException Raised if the event type is not supported by this object or if the listener is not a valid JavaScript function. This exception is also raised if the application calls addEventListener with the same combination of type and listener twice.

createRecordedContentSourceInstance ( sourceId )  → ToiRecordedContentSource

Returns a source instance for recorded content.

Parameters:

Name Type Description
sourceId
[optional]
ToiContentService.ToiSourceId

The source identifier. If no source identifier is specified the platform will choose the first available recorded content source if any.

Throws:

ToiInvalidArgumentException

Raised if

  • the specified application identifier is invalid.
  • the specified source identifier is not a recorded content source.
ToiInvalidPreconditionException

Raised if

  • the specified source identifier is not available.
  • there is no recorded content source available (when sourceId is unspecified).
ToiNotEnoughResourcesException

Raised if there are not enough resources to support creation of the content source instance.

Returns:

The content source instance.

Type: ToiRecordedContentSource
getContent ( callbacks , parameters )  → operation

Starts a best effort request for getting additional content information. Even if not all content information can be retrieved (e.g. content may not be available anymore) the operation will be set to completed. Any resulting ToiContentService.ToiContentInfo information will only include property values for the requested properties.

Parameters:

Name Type Description
callbacks AsyncCallback

Object with callback functions for the asynchronous operation. The callbacks.onResult() will be invoked with any incremental results of type Array.<ToiContentService.ToiContentInfo>. The final and accumulated result will be available as the property 'result' in the operation object after callbacks.onCompleted() has been invoked.

parameters ToiContentService.ToiContentParameters

The content request parameters.

Throws:

ToiInvalidArgumentException

Raised if

  • the specified operation identifier is invalid.
  • the parameters contain content identifiers that are invalid.
  • the parameters contain properties that are invalid.
ToiInvalidPreconditionException

Raised if the parameters contain content identifiers which belong to sources that are not available.

ToiNotEnoughResourcesException

Raised if it was not enough system resources to perform the request.

Returns:

operation The asynchronous operation created by the function.

Type: ToiAsynchronousOperation
getSources ( )  → Array.<ToiContentService.ToiSourceInfo>

Returns information about all available content sources.

Returns:

available content sources.

Type: Array.<ToiContentService.ToiSourceInfo>
remove ( callbacks , contentIds )  → operation

Removes the corresponding content for the given content identifiers.

Parameters:

Name Type Description
callbacks AsyncCallback

Object with callback functions for the asynchronous operation. No result is produced by this method, so callbacks.onResult() will not be invoked.

contentIds Array.<ToiContentService.ToiContentId> (Or a single ToiContentService.ToiContentId.)

The content identifiers. A single element can be passed directly and does not need to be passed in an array.

Throws:

ToiInvalidArgumentException

Raised if the operation identifier or any content identifier is invalid.

ToiInvalidPreconditionException

Raised if any content identifier belongs to a source that is not available.

ToiOperationNotSupportedException

Raised if any content source does not support content removal.

Returns:

operation The asynchronous operation created by the function.

Type: ToiAsynchronousOperation
removeEventListener ( type , listener )

This method removes an event listener for a specific event.

Inherited From:

  • ToiEventTarget#removeEventListener

Parameters:

Name Type Description
type number

The event type of the event to remove the listener from.

listener ToiEventListener

The JavaScript function that was previously added as an event listener.

Throws:

ToiInvalidArgumentException Raised if the event type is not supported by this object or if the listener is not a valid JavaScript function. This exception is also raised if the listener has not previously been added.

removeProperties ( callbacks , contentIds , propertyIds )  → operation

Remove properties for the given content.

Parameters:

Name Type Description
callbacks AsyncCallback

Object with callback functions for the asynchronous operation. No result is produced by this method, so callbacks.onResult() will not be invoked.

contentIds Array.<ToiContentService.ToiContentId> (Or a single ToiContentService.ToiContentId.)

The content identifiers to make the change for. A single element can be passed directly and does not need to be passed in an array.

propertyIds Array.<ToiContentService.ToiPropertyId>

The properties to remove.

Throws:

ToiInvalidArgumentException

Raised if

  • the specified operation identifier is invalid.
  • any content identifier is invalid.
  • any property is invalid.
ToiInvalidPreconditionException

Raised if any content identifier belongs to a source that is not available.

ToiOperationNotSupportedException

Raised if any content source does not support removal of properties.

Returns:

operation The asynchronous operation created by the function.

Type: ToiAsynchronousOperation
search ( callbacks , parameters )  → operation

Starts a search with the given condition. If multiple sources are included in the search, each source will only use the restrictions and properties it supports. The resulting ToiContentService.ToiContentInfo matches will only include property values for the requested properties.

Parameters:

Name Type Description
callbacks AsyncCallback

Object with callback functions for the asynchronous operation. The callbacks.onResult() will be invoked with any incremental results of type Array.<ToiContentService.ToiContentInfo>. The final and accumulated result will be available as the property 'result' in the operation object after callbacks.onCompleted() has been invoked.

parameters ToiContentService.ToiSearchParameters

The search parameters.

Throws:

ToiInvalidArgumentException

Raised if

  • the specified operation identifier is invalid.
  • the parameters contain source identifiers that are invalid.
  • the parameters contain properties that are invalid.
ToiInvalidPreconditionException

Raised if the parameters contain source identifiers for sources that are not available.

ToiOperationNotSupportedException

Raised if the parameters contain source properties that are not supported by any source.

ToiNotEnoughResourcesException

Raised if it was not enough system resources to perform the search.

Returns:

operation The asynchronous operation created by the function.

Type: ToiAsynchronousOperation
setProperties ( callbacks , contentIds , properties )  → operation

Sets properties for the given content.

Parameters:

Name Type Description
callbacks AsyncCallback

Object with callback functions for the asynchronous operation. No result is produced by this method, so callbacks.onResult() will not be invoked.

contentIds Array.<ToiContentService.ToiContentId> (Or a single ToiContentService.ToiContentId.)

The content identifiers to make the change for. A single element can be passed directly and does not need to be passed in an array.

properties ToiContentService.ToiPropertyMap

The properties to modify.

Throws:

ToiInvalidArgumentException

Raised if

  • the specified operation identifier is invalid.
  • any content identifier is invalid.
  • any property is invalid.
ToiInvalidPreconditionException

Raised if any content identifier belongs to a source that is not available.

ToiOperationNotSupportedException

Raised if any content source does not support setting properties.

Returns:

operation The asynchronous operation created by the function.

Type: ToiAsynchronousOperation

Members

ON_SOURCE_AVAILABLE (Type: ToiContentSourceAvailableEvent) (value = 2500) (static, constant)

This is an Event identifier for ToiContentSourceAvailableEvent.

This notification is triggered when a new source is available.

This constant can also be accessed from toi.consts.ToiContentService.ON_SOURCE_AVAILABLE.
ON_SOURCE_UNAVAILABLE (Type: ToiContentSourceUnavailableEvent) (value = 2501) (static, constant)

This is an Event identifier for ToiContentSourceUnavailableEvent.

This notification is triggered when a source is no longer available. Any source instance(s) created for this source by the application must be released immediately using ToiContentSource#releaseInstance.

This constant can also be accessed from toi.consts.ToiContentService.ON_SOURCE_UNAVAILABLE.
CONTENT_SOURCE_TYPE_DVR (Type: string) (value = 'dvr') (static, constant)

The source contains recorded content

This constant can also be accessed from toi.consts.ToiContentService.CONTENT_SOURCE_TYPE_DVR.
CONTENT_TYPE_AUDIO (Type: ToiContentService.ToiContentType) (value = 1) (static, constant)

Identifier for audio (only) content type.

This constant can also be accessed from toi.consts.ToiContentService.CONTENT_TYPE_AUDIO.
CONTENT_TYPE_IMAGE (Type: ToiContentService.ToiContentType) (value = 2) (static, constant)

Identifier for image content type.

This constant can also be accessed from toi.consts.ToiContentService.CONTENT_TYPE_IMAGE.
CONTENT_TYPE_VIDEO (Type: ToiContentService.ToiContentType) (value = 0) (static, constant)

Identifier for video (possibly with audio) content type.

This constant can also be accessed from toi.consts.ToiContentService.CONTENT_TYPE_VIDEO.
PROPERTY_CONTENT_BROKEN (Type: string) (value = 'broken') (static, constant)

If the content has this property set it is deemed broken. Will be treated as ToiContentService.PROPERTY_TYPE_BOOLEAN. This property is currently read-only by applications.

This constant can also be accessed from toi.consts.ToiContentService.PROPERTY_CONTENT_BROKEN.
PROPERTY_CONTENT_DESCRIPTION (Type: string) (value = 'description') (static, constant)

The content description. Will be treated as ToiContentService.PROPERTY_TYPE_STRING.

This constant can also be accessed from toi.consts.ToiContentService.PROPERTY_CONTENT_DESCRIPTION.
PROPERTY_CONTENT_DURATION (Type: string) (value = 'duration') (static, constant)

The content duration in seconds. Will be treated as ToiContentService.PROPERTY_TYPE_INTEGER. This property is currently read-only for applications.

This constant can also be accessed from toi.consts.ToiContentService.PROPERTY_CONTENT_DURATION.
PROPERTY_CONTENT_FILESIZE (Type: string) (value = 'filesize') (static, constant)

The content file size in bytes. Will be treated as ToiContentService.PROPERTY_TYPE_INTEGER. This property is currently read-only for applications.

This constant can also be accessed from toi.consts.ToiContentService.PROPERTY_CONTENT_FILESIZE.
PROPERTY_CONTENT_LONGDESCRIPTION (Type: string) (value = 'longdescription') (static, constant)

The even more detailed content description. Will be treated as ToiContentService.PROPERTY_TYPE_STRING.

This constant can also be accessed from toi.consts.ToiContentService.PROPERTY_CONTENT_LONGDESCRIPTION.
PROPERTY_CONTENT_LOST_AND_FOUND (Type: string) (value = 'lostandfound') (static, constant)

If the content has this property set it has been found by the source after being lost and has now been imported back into the source database. This could happen for example if the source database for some reason has been corrupted and reinitialized. Will be treated as ToiContentService.PROPERTY_TYPE_BOOLEAN.

This constant can also be accessed from toi.consts.ToiContentService.PROPERTY_CONTENT_LOST_AND_FOUND.
PROPERTY_CONTENT_TIMESTAMP (Type: string) (value = 'timestamp') (static, constant)

The content creation timestamp (number of seconds since the UNIX epoch). Will be treated as ToiContentService.PROPERTY_TYPE_DATE.

This constant can also be accessed from toi.consts.ToiContentService.PROPERTY_CONTENT_TIMESTAMP.
PROPERTY_CONTENT_TITLE (Type: string) (value = 'title') (static, constant)

The content name which is short and descriptive. Will be treated as ToiContentService.PROPERTY_TYPE_STRING.

This constant can also be accessed from toi.consts.ToiContentService.PROPERTY_CONTENT_TITLE.
PROPERTY_CONTENT_TYPE (Type: string) (value = 'type') (static, constant)

The content type. Will be treated as ToiContentService.PROPERTY_TYPE_INTEGER, see ToiContentService.ToiContentType for possible values. This property is currently read-only for applications.

This constant can also be accessed from toi.consts.ToiContentService.PROPERTY_CONTENT_TYPE.
PROPERTY_CONTENT_URI (Type: string) (value = 'uri') (static, constant)

The content URI to use for playback or rendering. Will be treated as ToiContentService.PROPERTY_TYPE_STRING. This property is currently read-only for applications.

This constant can also be accessed from toi.consts.ToiContentService.PROPERTY_CONTENT_URI.
PROPERTY_SOURCE_MAX_LIMIT (Type: string) (value = 'maxlimit') (static, constant)

The max number of content results to get in one search.

This constant can also be accessed from toi.consts.ToiContentService.PROPERTY_SOURCE_MAX_LIMIT.
PROPERTY_TYPE_BOOLEAN (Type: ToiContentService.ToiPropertyType) (value = 0) (static, constant)

Value of true/false.

This constant can also be accessed from toi.consts.ToiContentService.PROPERTY_TYPE_BOOLEAN.
PROPERTY_TYPE_DATE (Type: ToiContentService.ToiPropertyType) (value = 3) (static, constant)

A positive integer value, seconds since the epoch.

This constant can also be accessed from toi.consts.ToiContentService.PROPERTY_TYPE_DATE.
PROPERTY_TYPE_INTEGER (Type: ToiContentService.ToiPropertyType) (value = 2) (static, constant)

A signed integer value.

This constant can also be accessed from toi.consts.ToiContentService.PROPERTY_TYPE_INTEGER.
PROPERTY_TYPE_STRING (Type: ToiContentService.ToiPropertyType) (value = 1) (static, constant)

Any string value.

This constant can also be accessed from toi.consts.ToiContentService.PROPERTY_TYPE_STRING.
ToiCondition (Type: struct) (static)

Defines a matching condition for a single property.

Struct fields

Name Description
id

The property that shall be matched against the restriction.

Type: ToiContentService.ToiPropertyId
restrictions

The restriction definitions.

Note that TOI always provides an Array, even if there is only a single value.

Type: Array.<ToiContentService.ToiRestriction> (Or a single ToiContentService.ToiRestriction.)

ToiContentInfo (Type: struct) (static)

Structure containing content information.

Struct fields

Name Description
id

The unique content identifier.

Type: ToiContentService.ToiContentId
properties

The content metadata properties.

Type: ToiContentService.ToiPropertyMap
sourceId

The unique identifier of the source where the content is located.

Type: ToiContentService.ToiSourceId

ToiContentParameters (Type: struct) (static)

Specifies which content to get information about, and which additional properties that should be included in the result when performing a get content operation.

Struct fields

Name Description
contentIds

Content identifiers to request information for.

Note that TOI always provides an Array, even if there is only a single value.

Type: Array.<ToiContentService.ToiContentId> (Or a single ToiContentService.ToiContentId.)
requestedProperties
[optional]

Properties to be included in the content result.

Note that TOI always provides an Array, even if there is only a single value.

Type: Array.<ToiContentService.ToiPropertyId> (Or a single ToiContentService.ToiPropertyId.)

ToiProperty (Type: struct) (static)

Structure that represents a property identifier, value pair.

Struct fields

Name Description
id

The property identifier.

Type: ToiContentService.ToiPropertyId
value

The value this property has.

Type: string

ToiQueryCapabilities (Type: struct) (static)

Known query capabilities for a content source.

Struct fields

Name Description
isSortSupported

If sorting of results is supported by the source.

Type: boolean
supportedContentProperties

The content property identifiers supported by the source.

Note that TOI always provides an Array, even if there is only a single value.

Type: Array.<ToiContentService.ToiPropertyId> (Or a single ToiContentService.ToiPropertyId.)
supportedSourceProperties

The source property identifiers supported by the source.

Note that TOI always provides an Array, even if there is only a single value.

Type: Array.<ToiContentService.ToiPropertyId> (Or a single ToiContentService.ToiPropertyId.)

ToiRestriction (Type: struct) (static)

Defines a restriction for a property.

Struct fields

Name Description
equals
[optional]

This sets a specific value restriction for a property. The value need to be stringified if the intended property is of another type than ToiContentService.PROPERTY_TYPE_STRING.

Type: string
exists
[optional]

This sets a restriction on property existence.

Type: boolean
invert
[optional]

Setting this to 'true' inverts the restrictions.

Type: boolean
like
[optional]

This sets a fuzzy "well enough matching" string restriction for a property.

Type: string
max
[optional]

This sets a max value restriction for a property. The property will be interpreted as an integer type.

Type: number
min
[optional]

This sets a min value restriction for a property. The property will be interpreted as an integer type.

Type: number

ToiSearchParameters (Type: struct) (static)

Defines a structure with all the needed information to perform a search.

Struct fields

Name Description
contentConditions
[optional]

Conditions on content properties which all needs to be fulfilled to result in a content match.

Type: ToiContentService.ToiConditionMap
requestedProperties
[optional]

The properties to include for any matching content.

Note that TOI always provides an Array, even if there is only a single value.

Type: Array.<ToiContentService.ToiPropertyId> (Or a single ToiContentService.ToiPropertyId.)
sortRules
[optional]

The sort rules that shall be applied to the source result. The sorting is only applied if the sort rules are supported by the source. Please note that the sorting does not operate on the aggregated result from all sources.

Note that TOI always provides an Array, even if there is only a single value.

Type: Array.<ToiContentService.ToiSortRule> (Or a single ToiContentService.ToiSortRule.)
sourceConditions
[optional]

Conditions on source properties which all needs to be fulfilled by the source or the result set of the source.

Type: ToiContentService.ToiConditionMap
sources
[optional]

The sources to search in. If not present, the search will be done in all available sources.

Note that TOI always provides an Array, even if there is only a single value.

Type: Array.<ToiContentService.ToiSourceId> (Or a single ToiContentService.ToiSourceId.)

ToiSortRule (Type: struct) (static)

Definition of a sort rule which can be used for sorting search results if supported by the content source.

Struct fields

Name Description
id

Property identifier to sort on.

Type: ToiContentService.ToiPropertyId
sortAscending
[optional]

Ascending/descending sort order. Handled as true if not set.

Type: boolean
type
[optional]

Which type the property shall be treated as. If not set, it will be treated as a string.

Type: ToiContentService.ToiPropertyType

ToiSourceInfo (Type: struct) (static)

Information about a content source.

Struct fields

Name Description
id

The unique source identifier.

Type: ToiContentService.ToiSourceId
isLocal

True if the source is local to the STB (i.e. local filesystem).

Type: boolean
isNotificationSupported

True if new/changed/removed content is notified by the source.

Type: boolean
isPropertyModificationSupported

True if the source supports modifying content properties.

Type: boolean
isRemovalSupported

True if the source supports content removal.

Type: boolean
queryCapabilities

The query capabilities of the source.

Type: ToiContentService.ToiQueryCapabilities
secondaryApplication
[optional]

If set, the name of the secondary application associated with this source.

Type: string
type

The source type.

Type: ToiContentService.ToiSourceType

Events

ON_SOURCE_AVAILABLE ( )

This is an Event identifier for ToiContentSourceAvailableEvent.

Value: 2500

ON_SOURCE_UNAVAILABLE ( )

This is an Event identifier for ToiContentSourceUnavailableEvent.

Value: 2501

5.1.1.p8

Copyright (c) 2018 ARRIS Enterprises, LLC. All Rights Reserved. ARRIS Enterprises, LLC. Confidential Information.