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

Content Service Overview

The content service is responsible for providing applications with an interface where content from multiple sources can be searched for, and modified, in a unified way.

Sources

Information about available content sources can be retrieved by calling ToiContentService.getSources() which returns an array of ToiContentService.ToiSourceInfo. The application can also get notified when sources become available or unavailable by listening to the ON_SOURCE_AVAILABLE / ON_SOURCE_UNAVAILABLE events.

Each individual source has a globally unique source identifier which is specified in ToiContentService.ToiSourceInfo and should be used whenever an application want to address a particular source.

Source types

Each source belongs to a source type. Operations and notifications can be specific for a source type and in such case the content service provides a source type specific interface to be able to support the characteristics of the source. Even though the source type has a specific interface it can be restricted by the capabilities of each individual source. Common to all source type specific interfaces is the possibility for an application to register itself as a listener for notifications about added, removed or changed content on the specific source. Even these notifications can be unsupported by an individual source and the support for it is indicated by the isNotificationSupported flag in ToiContentService.ToiSourceInfo.

To get a handle to a specific source; the application has to call the source type specific create method in ToiContentService and pass the source identifier as argument. If a source identifier is not provided, the first available source of that type is returned.

Supported source types

Currently the only source type supported is CONTENT_SOURCE_TYPE_DVR which represents a source that manages content recorded by the KreaTV platform. Access to a source interface of this type is given by the method ToiContentService.createRecordedSourceInstance() which will return an ToiRecordedContentSource.

Source properties

Source properties are defined by the KreaTV platform. Some source properties describe the source while others can be used to instruct the source to format or restrict it's result in a search operation in some way. An example of such a source property is the PROPERTY_SOURCE_MAX_LIMIT which can be used to put a restriction on the number of matching content from the source.

Content

Content information is represented by ToiContentService.ToiContent. Each content is identified by a globally unique content identifier. If the content identifier is known; the application can retrieve information about the content by calling ToiContentService.getContent() and provide which properties it wants values for. The result for this operation will Content can also be removed by calling ToiContentService.remove() if the source where the content is stored supports content removal. This support is indicated by the isRemovalSupported flag in ToiContentService.ToiSourceInfo.

Content properties

Content properties are used to describe content. Some content properties are defined by the platform like PROPERTY_CONTENT_TITLE or PROPERTY_CONTENT_DURATION but applications are also free to set their own properties.

Properties defined by the platform can either be read-only or writable by applications. If the property is read-only that will be stated in the property description.

Properties are set using the ToiContentService.setProperties() function or removed using the ToiContentService.removeProperties() function. However all sources does not support modification of content properties and the support for it is indicated by the isPropertyModificationSupported flag in ToiContentService.ToiSourceInfo.

All properties are represented as strings so if the application need to treat the property as some other type it has to be converted.

Search

A central part of the content service is the ToiContentService.search() function. It is used to search for matching content based on conditions in the ToiContentService.ToiSearchParameters which is given as argument.

Search parameters

The following search parameters have an restrictive effect on the total number of content matches:

  • sources - If specified only content from sources in this list will be matched. Content from all other sources will be excluded. If not specified then search will include content from all available sources in the matching process.
  • sourceConditions - This parameter can be used to put conditions on the source. The conditions are operating on source properties (see ToiContentService.ToiCondition) which could either implicitly exclude the source from the search, because the source doesn't fulfill some property restriction, or it could restrict the result set from the source (see PROPERTY_SOURCE_MAX_LIMIT). So sources that has been included in the sources parameter (explicitly by specifying them in the list or implicitly by not providing a list) could still be excluded by these source conditions. The supported source properties that can be used in a condition is specified by each individual source through the supportedSourceProperties in ToiContentService.ToiQueryCapabilities which is part of ToiContentService.ToiSourceInfo
  • contentConditions - This parameter can be used to specify conditions on content properties (see ToiContentService.ToiCondition) which all have to be fulfilled by the content for it to be included in the result set. The supported content properties that can be used in a condition is specified by each individual source through the supportedContentProperties in ToiContentService.ToiQueryCapabilities which is part of ToiContentService.ToiSourceInfo.
  • When the matching content from a source have been found the following search parameters operates on the source result:

  • requestedProperties - The content properties to be included in the result, if available.
  • sortRules - This parameter can be used to specify how the content result from this source should be sorted based on content property values. The sort rules (see ToiContentService.ToiSortRule) are applied in order. This parameter will only take effect if the source has support for sorting which is indicated by the isSortSupported flag in ToiContentService.ToiQueryCapabilities which is part of ToiContentService.ToiSourceInfo. Please also note that the sorting is done on the result from each individual source, not on the aggregated result from all sources.
  • Search examples

    Search in all sources for content where the duration is at least one hour but at most two, and include the title and URI in the result:

    
    var searchParameters = {
       contentConditions: { "duration":  [ { min: 3600 }, { max: 7200 } ] },
       requestProperties: [ "title", "uri" ]
    };
    

    Search in the first source returned by getSources() after content that does not represent news and retrieve the title and URI. Also sort it based on when it was created and limit the result to 100 entries:

    
    var searchParameters = {
       sources: [ toi.contentService.getSources()[0].id ],
       sourceCondition: { "maxlimit": { equals: "100" } },
       contentConditions: { "description": { like: "news", invert: true } },
       requestProperties: [ "title", "uri" ],
       sortRules : [ { id: "timestamp", type: toi.consts.ToiContentService.PROPERTY_TYPE_DATE } ]
    };
    

    See also:TOI Content Service Interface

    5.1.1.p8

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