Author: andre
Date: 2009-09-23 16:02:12 +0200 (Wed, 23 Sep 2009)
New Revision: 38811

Modified:
   openimages/trunk/src/main/webapp/api/atom/index.jspx
   openimages/trunk/src/main/webapp/api/inc/atom.entry.jspx
Log:
refined atom feeds

Modified: openimages/trunk/src/main/webapp/api/atom/index.jspx
===================================================================
--- openimages/trunk/src/main/webapp/api/atom/index.jspx        2009-09-23 
13:02:15 UTC (rev 38810)
+++ openimages/trunk/src/main/webapp/api/atom/index.jspx        2009-09-23 
14:02:12 UTC (rev 38811)
@@ -1,7 +1,7 @@
 <mm:content
     type="application/xml"
     postprocessor="none"
-    expires="1800"
+    expires="0"
     xmlns:c="http://java.sun.com/jsp/jstl/core";
     xmlns:fmt="http://java.sun.com/jsp/jstl/fmt";
     xmlns:jsp="http://java.sun.com/JSP/Page";
@@ -79,7 +79,7 @@
     
     <mm:import id="requesturl"><c:out 
value="${pageContext.request.requestURL}" /><c:if test="${!empty 
pageContext.request.queryString}">?<c:out 
value="${pageContext.request.queryString}" /></c:if></mm:import>
     
-    <feed xmlns="http://www.w3.org/2005/Atom"; 
xmlns:media="http://search.yahoo.com/mrss";>
+    <feed xmlns="http://www.w3.org/2005/Atom"; 
xmlns:media="http://search.yahoo.com/mrss/";>
       <title>Open Images Platform / Open Beelden Platform</title>
       <subtitle>
         <c:choose>

Modified: openimages/trunk/src/main/webapp/api/inc/atom.entry.jspx
===================================================================
--- openimages/trunk/src/main/webapp/api/inc/atom.entry.jspx    2009-09-23 
13:02:15 UTC (rev 38810)
+++ openimages/trunk/src/main/webapp/api/inc/atom.entry.jspx    2009-09-23 
14:02:12 UTC (rev 38811)
@@ -10,6 +10,8 @@
     <mm:frameworkparam name="component">oip</mm:frameworkparam>
     <mm:frameworkparam name="block">mediafragment</mm:frameworkparam>
     <mm:frameworkparam name="media">${_node}</mm:frameworkparam>
+    
+    <mm:import id="mediatype" reset="true"><mm:nodeinfo type="type" 
/></mm:import>
 
     <title>
       <mm:field name="title"><mm:isnotempty>${_}</mm:isnotempty><mm:isempty>no 
title</mm:isempty></mm:field>
@@ -46,38 +48,57 @@
         <c:otherwise><mm:import id="length">0</mm:import></c:otherwise>
       </c:choose>
     </mm:field>
-    
-    <mm:listfunction name="filteredurls" varStatus="status">
-      <c:set var="mimetype" value="${fn:toLowerCase(_.format.mimeType)}" />
-      <c:set var="format" value="${fn:toLowerCase(_.format)}" />
-      <c:if test="${_.available}">
-        <link type="${mimetype}" href="${_.URL}" length="${length}" 
rel="enclosure" />
-        <mm:node number="${_.source.number}">
-          <format xmlns="http://xmlns.transmission.cc/";>
-            <size><mm:field name="filesize" />1000</size>
-            <duration>${length}</duration>
-            <video_codec>${fn:toLowerCase(_.codec)} | format: 
${format}</video_codec> 
-            <mm:hasfield name="fps"><framerate><mm:field name="fps" 
/></framerate></mm:hasfield>
-            <video_bitrate>${_.bitrate}</video_bitrate> <!-- format 394.570050 
? -->
-            <mm:hasfield name="width">
-              <width><mm:field name="width" /></width>
-              <height><mm:field name="height" /></height>
-            </mm:hasfield>
-            <mm:hasfield name="channels"><mm:field name="channels" 
/></mm:hasfield>
-  <!--
-            <pixel_aspect_ratio>1/1</pixel_aspect_ratio> 
-            <audio_codec>Vorbis</audio_codec> 
-            <samplerate>48000</samplerate> 
-            <channels>2</channels> 
-            <audio_bitrate>73.261261</audio_bitrate> -->
-          </format> 
-        </mm:node>
-        <!-- link to resource  --> 
-        <link rel="enclosure" type="${mimetype}" length="${length}" 
-            href="${_.URL}" />
-      </c:if>
-    </mm:listfunction>
 
+    <mm:function name="filteredurls">
+      <link type="${_[0].mimeType}" href="${_[0].URL}" length="${length}" 
rel="enclosure" />
+
+      <mm:node number="${_[0].source.number}">
+        <format xmlns="http://xmlns.transmission.cc/";>
+          <size><mm:field name="filesize" /></size>
+          <c:choose>
+            <c:when test="${fn:startsWith(mediatype, 'audio')}">
+              <duration>${length}</duration>
+              <audio_codec>${fn:toLowerCase(_[0].codec)}</audio_codec>
+              <audio_bitrate>${_[0].bitrate}</audio_bitrate>
+            </c:when>
+            <c:when test="${fn:startsWith(mediatype, 'image')}">
+              <mm:hasfield name="width">
+                <width><mm:field name="width" /></width>
+                <height><mm:field name="height" /></height>
+              </mm:hasfield>
+            </c:when>
+            <c:otherwise>
+              <duration>${length}</duration>
+              <video_codec>${fn:toLowerCase(_[0].codec)}</video_codec>
+              <mm:hasfield name="fps">
+                <mm:field name="fps">
+                  <mm:isnotempty><framerate><c:if test="${_ gt -1}"><mm:write 
/></c:if></framerate></mm:isnotempty>
+                </mm:field>
+              </mm:hasfield>
+              <c:if test="${_[0].bitrate gt 0}">
+                <video_bitrate>${_[0].bitrate}</video_bitrate> <!-- format 
394.570050 ? -->
+              </c:if>
+              <mm:hasfield name="width">
+                <width><mm:field name="width" /></width>
+                <height><mm:field name="height" /></height>
+              </mm:hasfield>
+              <mm:hasfield name="channels">
+                <mm:field name="channels">
+                  <mm:isnotempty><channels><c:if test="${_ gt -1}"><mm:write 
/></c:if></channels></mm:isnotempty>
+                </mm:field>
+              </mm:hasfield>
+            </c:otherwise>
+          </c:choose>
+<!--
+          <pixel_aspect_ratio>1/1</pixel_aspect_ratio> 
+          <audio_codec>Vorbis</audio_codec> 
+          <samplerate>48000</samplerate> 
+          <channels>2</channels> 
+          <audio_bitrate>73.261261</audio_bitrate> -->
+        </format> 
+      </mm:node>
+    </mm:function>
+
     <mm:relatednodescontainer type="licenses" role="related" 
searchdirs="destination">
       <mm:relatednodes>
         <mm:import id="license_url" reset="true"><mm:field name="url" 
/></mm:import>

_______________________________________________
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to