diff --git a/modules/tobira/src/main/java/org/opencastproject/tobira/impl/Item.java b/modules/tobira/src/main/java/org/opencastproject/tobira/impl/Item.java index b764dcd95ff..ac2b747cd05 100644 --- a/modules/tobira/src/main/java/org/opencastproject/tobira/impl/Item.java +++ b/modules/tobira/src/main/java/org/opencastproject/tobira/impl/Item.java @@ -125,6 +125,12 @@ class Item { final var captions = findCaptions(mp); + // Get the generated slide text. + final var slideText = Arrays.stream(mp.getElements()) + .filter(mpe -> mpe.getFlavor().eq("mpeg-7/text")) + .map(element -> element.getURI()) + .findFirst(); + // Obtain duration from tracks, as that's usually more accurate (stores information from // inspect operations). Fall back to `getDcExtent`. final var duration = Arrays.stream(mp.getTracks()) @@ -158,6 +164,8 @@ class Item { "created", "creator", "title", "extent", "isPartOf", "description", "identifier", }))), Jsons.p("captions", Jsons.arr(captions)), + Jsons.p("slideText", slideText.map(t -> t.toString()).orElse(null)), + Jsons.p("segments", Jsons.arr(findSegments(mp))), Jsons.p("updated", event.getModified().getTime()) ); } @@ -321,6 +329,17 @@ private static String findThumbnail(MediaPackage mp) { .orElse(null); } + private static List findSegments(MediaPackage mp) { + return Arrays.stream(mp.getAttachments()) + .filter(a -> a.getFlavor().getSubtype().equals("segment+preview")) + .map(s -> Jsons.obj( + Jsons.p("uri", s.toString()), + Jsons.p("startTime", s.getReference().getProperty("time")) + ) + ) + .collect(Collectors.toCollection(ArrayList::new)); + } + private static Jsons.Val findTimelinePreview(MediaPackage mp) { return Arrays.stream(mp.getAttachments()) .filter(a -> a.getFlavor().getSubtype().equals("timeline+preview")) diff --git a/modules/tobira/src/main/java/org/opencastproject/tobira/impl/TobiraEndpoint.java b/modules/tobira/src/main/java/org/opencastproject/tobira/impl/TobiraEndpoint.java index 6d20f4096cf..1552b7443a0 100644 --- a/modules/tobira/src/main/java/org/opencastproject/tobira/impl/TobiraEndpoint.java +++ b/modules/tobira/src/main/java/org/opencastproject/tobira/impl/TobiraEndpoint.java @@ -81,7 +81,7 @@ public class TobiraEndpoint { // Versioning the Tobira API: // - // Since both Tobira and this API are changing over time, we need some machanism for ensuring they + // Since both Tobira and this API are changing over time, we need some mechanism for ensuring they // are compatible. We don't want to enforce a 1:1 thing, where a particular Tobira needs one // exact API as that makes the update process harder (especially once this module is included in // the community version). So instead we have some semver-like versioning here. Increase the @@ -95,7 +95,7 @@ public class TobiraEndpoint { // adding new JSON fields is a non-breaking change. You should also consider whether Tobira needs // to resynchronize, i.e. to get new data. private static final int VERSION_MAJOR = 1; - private static final int VERSION_MINOR = 5; + private static final int VERSION_MINOR = 6; private static final String VERSION = VERSION_MAJOR + "." + VERSION_MINOR; private SearchService searchService;