From 3e21bdd53b068950de74eb2d703a56db4fc9e5b1 Mon Sep 17 00:00:00 2001 From: JonathanTGold Date: Sun, 25 Jun 2023 16:20:37 +0300 Subject: [PATCH 1/2] fix(FEC-13134): add views and plays counts to media entry metadata if available --- src/k-provider/ovp/provider-parser.js | 2 ++ .../request-params/base-entry-response-profile.js | 2 +- .../ovp/response-types/kaltura-media-entry.js | 12 ++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/k-provider/ovp/provider-parser.js b/src/k-provider/ovp/provider-parser.js index 5ed5c831..de97a086 100644 --- a/src/k-provider/ovp/provider-parser.js +++ b/src/k-provider/ovp/provider-parser.js @@ -158,6 +158,8 @@ class OVPProviderParser { if (entry.liveStatus) mediaEntry.metadata.liveStatus = entry.liveStatus; if (entry.createdAt) mediaEntry.metadata.createdAt = entry.createdAt; if (entry.endDate) mediaEntry.metadata.endDate = entry.endDate; + if (entry.views) mediaEntry.metadata.views = entry.views; + if (entry.plays) mediaEntry.metadata.plays = entry.plays; mediaEntry.metadata.tags = entry.tags || ''; mediaEntry.status = entry.status; diff --git a/src/k-provider/ovp/request-params/base-entry-response-profile.js b/src/k-provider/ovp/request-params/base-entry-response-profile.js index 3708b773..8e95e3de 100644 --- a/src/k-provider/ovp/request-params/base-entry-response-profile.js +++ b/src/k-provider/ovp/request-params/base-entry-response-profile.js @@ -1,6 +1,6 @@ //@flow const FIELDS = - 'id,referenceId,name,description,thumbnailUrl,dataUrl,duration,msDuration,flavorParamsIds,mediaType,type,tags,dvrStatus,externalSourceType,status,liveStatus,createdAt,endDate'; + 'id,referenceId,name,description,thumbnailUrl,dataUrl,duration,msDuration,flavorParamsIds,mediaType,type,tags,dvrStatus,externalSourceType,status,liveStatus,createdAt,endDate,plays,views'; const RESPONSE_PROFILE_TYPE = { INCLUDE_FIELDS: 1, EXCLUDE_FIELDS: 2 diff --git a/src/k-provider/ovp/response-types/kaltura-media-entry.js b/src/k-provider/ovp/response-types/kaltura-media-entry.js index 33499536..00f70cc2 100644 --- a/src/k-provider/ovp/response-types/kaltura-media-entry.js +++ b/src/k-provider/ovp/response-types/kaltura-media-entry.js @@ -150,6 +150,18 @@ export class KalturaMediaEntry { */ endDate: number; + /** + * @member - Number of plays + * @type {number} + */ + plays: number; + + /** + * @member - Number of views + * @type {number} + */ + views: number; + /** * @constructor * @param {Object} entry The json response From 650078da30994fc5868cdac01fe2498637eef02d Mon Sep 17 00:00:00 2001 From: JonathanTGold Date: Sun, 2 Jul 2023 16:26:34 +0300 Subject: [PATCH 2/2] fix --- src/k-provider/ott/response-types/kaltura-asset.js | 14 ++++++++++++++ .../request-params/base-entry-response-profile.js | 2 +- .../ovp/response-types/kaltura-media-entry.js | 2 ++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/k-provider/ott/response-types/kaltura-asset.js b/src/k-provider/ott/response-types/kaltura-asset.js index ab93787c..218644da 100644 --- a/src/k-provider/ott/response-types/kaltura-asset.js +++ b/src/k-provider/ott/response-types/kaltura-asset.js @@ -55,6 +55,18 @@ export default class KalturaAsset extends ServiceResult { */ pictures: Array = []; + /** + * @member - Number of plays + * @type {number} + */ + plays: number; + + /** + * @member - Number of views + * @type {number} + */ + views: number; + /** * @constructor * @param {Object} response The response @@ -67,6 +79,8 @@ export default class KalturaAsset extends ServiceResult { this.description = response.description; this.createDate = response.createDate; this.endDate = response.endDate; + this.plays = response.plays; + this.views = response.views; this.metas = this._formatTagsMetas(response.metas); this.tags = this._formatTagsMetas(response.tags); this.pictures = response.images; diff --git a/src/k-provider/ovp/request-params/base-entry-response-profile.js b/src/k-provider/ovp/request-params/base-entry-response-profile.js index 8e95e3de..633e4c40 100644 --- a/src/k-provider/ovp/request-params/base-entry-response-profile.js +++ b/src/k-provider/ovp/request-params/base-entry-response-profile.js @@ -1,6 +1,6 @@ //@flow const FIELDS = - 'id,referenceId,name,description,thumbnailUrl,dataUrl,duration,msDuration,flavorParamsIds,mediaType,type,tags,dvrStatus,externalSourceType,status,liveStatus,createdAt,endDate,plays,views'; + 'id,referenceId,name,description,thumbnailUrl,dataUrl,duration,msDuration,flavorParamsIds,mediaType,type,tags,dvrStatus,externalSourceType,status,createdAt,endDate,plays,views'; const RESPONSE_PROFILE_TYPE = { INCLUDE_FIELDS: 1, EXCLUDE_FIELDS: 2 diff --git a/src/k-provider/ovp/response-types/kaltura-media-entry.js b/src/k-provider/ovp/response-types/kaltura-media-entry.js index 00f70cc2..d709082b 100644 --- a/src/k-provider/ovp/response-types/kaltura-media-entry.js +++ b/src/k-provider/ovp/response-types/kaltura-media-entry.js @@ -184,5 +184,7 @@ export class KalturaMediaEntry { this.tags = entry.tags; this.createdAt = entry.createdAt; this.endDate = entry.endDate; + this.plays = entry.plays; + this.views = entry.views; } }