Skip to content

Commit

Permalink
Add related content purpose to recommended api
Browse files Browse the repository at this point in the history
With RTS & SRF recommendations
  • Loading branch information
pyby committed Oct 29, 2020
1 parent 48a2b6f commit 00a0a1f
Showing 1 changed file with 33 additions and 14 deletions.
47 changes: 33 additions & 14 deletions src/main/java/ch/srgssr/playfff/service/RecommendationService.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,38 @@ public RecommendationService() {

public RecommendedList getRecommendedUrns(String purpose, String urnString, boolean standalone) {
IlUrn urn = new IlUrn(urnString);
switch (urn.getMam()) {
case RTS:
if (urn.getMediaType() == MediaType.VIDEO) {
return rtsVideoRecommendedList(purpose, urnString, standalone);
} else if (urn.getMediaType() == MediaType.AUDIO) {
return pfffRecommendedList(urnString, MediaType.AUDIO, standalone);
}
break;
case RSI:
case RTR:
case SRF:
case SWI:
return pfffRecommendedList(urnString, urn.getMediaType(), standalone);
if (purpose.equals("relatedContent")) {
switch (urn.getMam()) {
case RTS:
if (urn.getMediaType() == MediaType.VIDEO) {
return rtsVideoRecommendedList(purpose, urnString, standalone);
} else if (urn.getMediaType() == MediaType.AUDIO) {
return pfffRecommendedList(urnString, MediaType.AUDIO, standalone);
}
break;
case SRF:
return srfRecommendedList(purpose, urnString, standalone);
case RSI:
case RTR:
case SWI:
return pfffRecommendedList(urnString, urn.getMediaType(), standalone);
}
}
else {
switch (urn.getMam()) {
case RTS:
if (urn.getMediaType() == MediaType.VIDEO) {
return rtsVideoRecommendedList(purpose, urnString, standalone);
} else if (urn.getMediaType() == MediaType.AUDIO) {
return pfffRecommendedList(urnString, MediaType.AUDIO, standalone);
}
break;
case RSI:
case RTR:
case SRF:
case SWI:
return pfffRecommendedList(urnString, urn.getMediaType(), standalone);
}
}
return new RecommendedList();
}
Expand Down Expand Up @@ -196,7 +215,7 @@ public RecommendedList rtsPlayHomePersonalRecommendation(String userId) {
return new RecommendedList(result.getTitle(), url.getHost(), result.getRecommendationId(), result.getUrns());
}

private RecommendedList srfVideoRecommendedList(String purpose, String urn, boolean standalone) {
private RecommendedList srfRecommendedList(String purpose, String urn, boolean standalone) {
long timestamp = System.currentTimeMillis();

Environment environment = Environment.PROD;
Expand Down

0 comments on commit 00a0a1f

Please sign in to comment.