Closed Bug 1030814 Opened 10 years ago Closed 6 years ago

[Stingray] TV Web API for Searching Programs

Categories

(Firefox OS Graveyard :: General, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: airpingu, Unassigned)

References

Details

(Whiteboard: [ft:conndevices])

User Story

We hope to provide Web APIs for searching TV programs based on the programs' metadata. Basically, two types of searching functions need to be supported:

  1. Search by the start time, the end time and the channel.

  2. Search by any kinds of fields, including name, genre, actor name... etc.

Also, this Web API has to be exposed to any kinds of third-party apps.
OIPF APIs provide some useful semantic for the clients to compose the searching filters. For example, the web developers can use "createQuery(fieldName)" plus "and"/"or"/... operators to decide how to search the desired programs. An example is shown as below:

  function getGuideData() {
    // Instantiate the search manager
    var mySearchMgr = window.oipfObjectFactory.createSearchManagerObject();
    mySearchMgr.addEventListener(“MetadataSearch”, searchUpdate);

    // Create the search object to search EPG data
    mySearch = mySearchMgr.createSearch(1);

    // Get the start time for the search. We round down to the previous
    // half-hour boundary
    var now = Math.round(new Date().getTime()/1000.0);
    var gridStart = (Math.floor(now/1800)) *1800);

    //Now use that to set the start and end times for the search
    var startQuery = mySearch.createQuery("startTime", 3, gridStart);

    // Assume the grid holds two hours worth of programmes
    var endQuery = mySearch.createQuery("startTime", 4, gridStart + 7200);

    // Now set that query
    mySearch.query = startQuery.and(endQuery);

    // Constrain the search to return only those programmes below the current
    // parental rating threshold
    mySearch.addCurrentRatingConstraint();

    // Start the search, getting the first 50 results
    if (mySearch.result.getResults(0, 50)) {
      // All our data is available immediately
      processSearchResults();
    } else {
      // We need to wait.
    }
  }

This approach might be extensible and flexible for the Web developers because they can easily use "createQuery(...)" to construct the querying criteria in a generic way to search programs. That means we don't need worry about how to define various Web APIs for searching different kinds of fields.

However, the downside of this approach is the implementation feasibility on the platform which still needs to implement and enhance the searching capabilities whenever a new program field is added to be considered. This could be an endless job in the long term and might be hard to implement especially when the fields' matrix is getting complicated.

Another approach is applying the DataStore API [1] which lets the third-party apps be responsible for maintaining their own filtering criteria and searching algorithm by using the IndexedDB API. What the apps need to do is to use the DataStore API to keep synchronized with the "programs" data store. That is, the programs in the data store can be managed by a certified System/TV App and the data can be shared as read-only by other third-party apps.

However, one big concern of using DataStore API and IndexedDB API is about the synchronizing performances. That is, whenever the EIT content is updated by the TV broadcaster, the System/TV app has to flush the whole "programs" data store and other third-party apps need to synchronize all the new programs into their local indexed DBs. Assuming the number of programs can be up to 1000000, both the synchronizing performance and the index-updating performance have to be carefully considered.

[1] https://wiki.mozilla.org/WebAPI/DataStore
Whiteboard: [FT:Stream3] → [ft:conndevices]
Blocks: TV_FxOS2.5
No longer blocks: TV_FxOS2.5
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.