Skip to content

Commit

Permalink
fix(FEC-13134): add views and plays counts to media entry metadata if…
Browse files Browse the repository at this point in the history
… available (#220)

solves FEC-13134
  • Loading branch information
JonathanTGold authored Jul 9, 2023
1 parent d278a48 commit 9ee39ec
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/k-provider/ott/response-types/kaltura-asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ export default class KalturaAsset extends ServiceResult {
*/
pictures: Array<any> = [];

/**
* @member - Number of plays
* @type {number}
*/
plays: number;

/**
* @member - Number of views
* @type {number}
*/
views: number;

/**
* @constructor
* @param {Object} response The response
Expand All @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/k-provider/ovp/provider-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ class OVPProviderParser {
mediaEntry.metadata.name = entry.name || '';
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;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//@flow
const FIELDS =
'id,referenceId,name,description,thumbnailUrl,dataUrl,duration,msDuration,flavorParamsIds,mediaType,type,tags,dvrStatus,externalSourceType,status,createdAt,endDate';
'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
Expand Down
14 changes: 14 additions & 0 deletions src/k-provider/ovp/response-types/kaltura-media-entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,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
Expand All @@ -151,5 +163,7 @@ export class KalturaMediaEntry {
this.tags = entry.tags;
this.createdAt = entry.createdAt;
this.endDate = entry.endDate;
this.plays = entry.plays;
this.views = entry.views;
}
}

0 comments on commit 9ee39ec

Please sign in to comment.