From 85e847f41fd7adbf0a432be710a344cbbceb50ac Mon Sep 17 00:00:00 2001 From: Paul Legan Date: Thu, 7 Apr 2022 16:02:35 -0400 Subject: [PATCH] BC-57 - Updated Video Dropdown to Include Name and ID in Values --- .../brightcove/wrapper/models/VideoPlayer.java | 14 +++++++++++++- .../brightcove/wrapper/webservices/BrcApi.java | 5 +++-- .../src/main/content/META-INF/vault/filter.xml | 7 +++---- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/current/core/src/main/java/com/coresecure/brightcove/wrapper/models/VideoPlayer.java b/current/core/src/main/java/com/coresecure/brightcove/wrapper/models/VideoPlayer.java index 6a7f6ff..e1e04f4 100644 --- a/current/core/src/main/java/com/coresecure/brightcove/wrapper/models/VideoPlayer.java +++ b/current/core/src/main/java/com/coresecure/brightcove/wrapper/models/VideoPlayer.java @@ -33,6 +33,9 @@ import java.util.UUID; import org.apache.jackrabbit.util.Text; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + @Model( adaptables=SlingHttpServletRequest.class ) @@ -222,7 +225,7 @@ protected void init(){ LOGGER.info("found asset video id : " + droppedVideoId); LOGGER.info("current video id : " + currentNode.getProperty("videoPlayer").getString()); currentNode.setProperty("videoPlayer", droppedVideoId); - + // now delete the property for next time to be clean currentNode.setProperty("videoPlayerDropPath", ""); @@ -230,6 +233,15 @@ protected void init(){ } videoID = properties.get("videoPlayer", "").trim(); + + // check to see if the video ID is actually in the format "name [ID]" + Pattern p = Pattern.compile("\\[(.*?)\\]"); + Matcher m = p.matcher(videoID); + + if (m.find()) { + videoID = m.group(1); + } + playlistID = properties.get("videoPlayerPL", "").trim(); account = properties.get("account", "").trim(); diff --git a/current/core/src/main/java/com/coresecure/brightcove/wrapper/webservices/BrcApi.java b/current/core/src/main/java/com/coresecure/brightcove/wrapper/webservices/BrcApi.java index ab5d66f..89e31d0 100755 --- a/current/core/src/main/java/com/coresecure/brightcove/wrapper/webservices/BrcApi.java +++ b/current/core/src/main/java/com/coresecure/brightcove/wrapper/webservices/BrcApi.java @@ -197,7 +197,7 @@ private JSONObject deletePlaylist(SlingHttpServletRequest request) throws JSONEx result = serviceUtil.deletePlaylist(request.getParameter("playlist")); return result; } - + private JSONObject getVideosInFolder(SlingHttpServletRequest request) throws JSONException { JSONObject result = new JSONObject(); result = new JSONObject(serviceUtil.getVideosInFolder(request.getParameter("folder"), Integer.parseInt(request.getParameter(Constants.START)))); @@ -681,8 +681,9 @@ private void executeRequest(final SlingHttpServletRequest request, StringBuilder builder = new StringBuilder(); for (int i = 0; i < itemsArray.length(); i++) { JSONObject item = new JSONObject(); - builder.append("
  • " + itemsArray.getJSONObject(i).getString("name") + "
  • "); + builder.append("
  • " + itemsArray.getJSONObject(i).getString("name") + " [" + itemsArray.getJSONObject(i).getString("id") + "]
  • "); } + LOGGER.debug("dropdown values requested"); response.getWriter().write(builder.toString()); break try_loop; } diff --git a/current/ui.apps/src/main/content/META-INF/vault/filter.xml b/current/ui.apps/src/main/content/META-INF/vault/filter.xml index da66c21..c892f51 100644 --- a/current/ui.apps/src/main/content/META-INF/vault/filter.xml +++ b/current/ui.apps/src/main/content/META-INF/vault/filter.xml @@ -9,9 +9,9 @@ --> - - - + + @@ -28,7 +28,6 @@ -