Categories:
TV Recommend plugin
Complex Logic Framework plugin for the TV Recommend use case
Introduction
The TV Recommend plugin resolves requests from a user to obtain personalized recommendations for audiovisual content from Telefónica catalogs.
- Intent:
intent.tv.recommend - Main result intents:
MEDIA.SEARCH(default),CHANNEL.PLAY(when zapping to a live channel).
Validate input request
This step validates that the input request fulfills all the requirements from the input schema.
If the input data is invalid, the resource returned is:
Entities used for search
The plugin works with the following entity types:
| Entity type | Usage in search | Notes |
|---|---|---|
ent.audiovisual_channel |
Yes | Multiple values accepted, separated by ||. |
ent.audiovisual_person |
Yes | For participants (actors, directors, presenters, etc.), multiple values accepted with ||. |
ent.audiovisual_query |
Yes | Free text query, multiple values accepted with ||. |
Multiple entities & values:
You can repeat the same entity type multiple times and/or provide several values in a single entity using the \|\| separator.
Building the search query
The plugin constructs two query strings:
-
search_query→ technical query sent to Kernel API:- Group query and channel entities in parentheses.
- Joins different entity types with
AND. - Query: split on ||, trim each value, and join with OR inside the parentheses (no quotes).
- Channel: trim each value, wrap each value in quotes, and join with OR inside the parentheses.
- Person: trim each value, wrap each value in quotes, and join with AND (no group parentheses).
- Example:
("La 1" OR "La 2") AND "Brad Pitt" AND (mystery OR series)
-
search_query_response→ a simplified, user-readable query string included in the payload and telemetry.
If no entities are present, the plugin returns a no results response.
API video query (Handler 4P)
Plugin calls Handler4P.tv_4p_handler.get_user_content_search(...) with the following parameters:
user_id:data[aura_user][user_id]administrative_number:data[app_context][user][account_number]access_token:data[aura_user][access_token]scopes:data[aura_user][scopes]purposes:data[aura_user][purposes]device_type:data[app_context][device][type]catalog_types:- Default:
VOD,LIVE,L7D - Allowed:
VOD,LIVE,L7D,LCH,LSR - Filtered according to
allowed_catalog_typesof the device
- Default:
search_query: built as explained aboveshow_series:seriesprofile:data[app_context][user][video_profile_name](optional; only if present to avoid API 501 errors)commercialization_types:[SVOD]max_quality:data[app_context][device][max_quality](optional)current_region:data[app_context][location][currentRegion](optional)order:personal
Response logic
Depending on the number and type of results, the plugin builds different responses:
1. No results
- Plays negative sound unless the channel is disabled in the
sound_disabled_channelsconfiguration result_intent:MEDIA.SEARCH- Resource:
tv:video.recommend.no-results - Status:
SUCCESS.NO_CONTENT
2. One result
- Live channel:
- Payload:
{ type: details, data: <channel info> } - Action:
REMOTEON.ZAPTO(with paramschannelIdanddeviceId) - Plays positive sound unless the channel is disabled in the
sound_disabled_channelsconfiguration result_intent:CHANNEL.PLAY- Resource:
tv:video.recommend.display.single-result
- Payload:
- Non-live content (VOD, L7D, etc.):
- Payload: details of the single item
- Plays positive sound
result_intent:MEDIA.SEARCH- Resource:
tv:video.recommend.by-default.simple-result
3. Multiple results
- Payload: content list and
search_query(search query response string) - Plays positive sound unless the channel is disabled in the
sound_disabled_channelsconfiguration result_intent:MEDIA.SEARCH- Resource:
tv:video.recommend.multiple-results(with paramquery_displayed)
Resources returned
The TV Recommend plugin may return the following resources:
tv:video.model-validation.request.error→ input validation errortv:video.api.answer.error→ API Video errortv:video.recommend.no-results→ no content foundtv:video.recommend.by-default.simple-result→ one non-live resulttv:video.recommend.multiple-results→ multiple resultstv:video.recommend.display.single-result→ one live channel (tune channel)
Payload and actions
-
Payload:
type:details(single item) orcontent_list(multiple items)data: item(s) from Kernel API- For multiple results: includes
search_query(human-readable string)
-
Actions:
- Sound feedback (positive/negative)
- For a single live channel:
{"name": "REMOTEON.ZAPTO", "params": {"channelId": "$channelId", "deviceId": "$deviceId"}, "target": "stb"}
Status codes
status: Final status request. This field includes the following parameters:code: Status code with value:SUCCESS,SUCCESS.NO_CONTENTorERROR.INTERNAL.message: Status message, which describes the status code.params: Parameter that sends details of status. This field does not appear if it is empty.
Example behavior
- “Recommend me something”
- for a single live channel result →
CHANNEL.PLAYtune channel with live channel. - for a multiple results →
MEDIA.SEARCHwithtv:video.recommend.multiple-results. - for any results →
tv:video.recommend.no-results.
- for a single live channel result →