From: <jbo...@li...> - 2005-12-16 22:54:38
|
Author: wrzep Date: 2005-12-16 17:54:29 -0500 (Fri, 16 Dec 2005) New Revision: 1826 Modified: trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/Podcast.java Log: item and channel images parsing http://jira.jboss.com/jira/browse/JBLAB-540 Pawel Modified: trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/Podcast.java =================================================================== --- trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/Podcast.java 2005-12-16 21:09:02 UTC (rev 1825) +++ trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/Podcast.java 2005-12-16 22:54:29 UTC (rev 1826) @@ -132,6 +132,7 @@ * @param item ItemIF to get information from */ private void fillItemInfo(DelegateContext nodeContext, ItemIF item) { + nodeContext.put("title", item.getTitle()); nodeContext.put("description", item.getDescription()); @@ -147,6 +148,15 @@ if (link != null) { nodeContext.put("link", link.toString()); } + + // For unknown reasons there is not item.getImage() method (informa version 0.6.5) + String[] imageProperties = item.getElementValues("image", + new String[] {"title", "url", "link", "width", "height", "description"} ); + + if (imageProperties != null) { + nodeContext.put("image", imageProperties[1]); + nodeContext.next("hasImage"); + } } /** @@ -176,22 +186,19 @@ * @param item ChannelIF to get information from */ private void fillChannelInfo(DelegateContext nodeContext, ChannelIF channel) { + nodeContext.put("channel-title", channel.getTitle()); URL channelLocation = channel.getLocation(); + if (channelLocation != null) { nodeContext.put("channel-link", channelLocation.toString()); } ImageIF channelImage = channel.getImage(); - System.out.println("image: " + channelImage); - if (channelImage != null) { - System.out.println("location: " + channelImage.getLocation() + - " / link: " + channelImage.getLink()); - } - if ((channelImage != null) && (channelImage.getLocation() != null)) { nodeContext.put("channel-image", channelImage.getLocation().toString()); + nodeContext.next("channel-hasImage"); } } |