[FFmpeg-devel] [PATCH 2/2] add content to rss-file

Gerion Entrup gerion.entrup at t-online.de
Sat Apr 12 00:03:15 CEST 2014


2nd try
---
 Makefile | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index db2ac28..86922cd 100644
--- a/Makefile
+++ b/Makefile
@@ -19,19 +19,35 @@ htdocs/%.html: src/% src/%_title $(PAGE_DEPS)
 
 htdocs/main.rss: htdocs/index.html
 	echo '<?xml version="1.0" encoding="UTF-8" ?>' > $@
-	echo '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">' >> $@
+	echo '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">' >> $@
 	echo '<channel>' >> $@
 	echo '    <title>FFmpeg RSS</title>' >> $@
 	echo '    <link>http://ffmpeg.org</link>' >> $@
 	echo '    <description>FFmpeg RSS</description>' >> $@
 	echo '    <atom:link href="http://ffmpeg.org/main.rss" rel="self" type="application/rss+xml" />' >> $@
-	grep '<a *id=".*" *></a><h3>.*20..,.*</h3>' $< | sed 'sX<a *id="\(.*\)" *> *</a> *<h3>\(.*20..\), *\(.*\)</h3>X\
+	NSTART=''
+	while read line; do \
+		if echo "$$line" | grep '<h1>Older entries are in the .*news archive' -q ; then \
+			break; \
+		fi; \
+		if echo "$$line" | grep '<a *id=".*" *></a><h3>.*20..,.*</h3>' -q ; then \
+			if [ $$NSTART ]; then \
+				echo "        ]]></content:encoded>" >> $@; \
+				echo "    </item>" >> $@ ; echo >> $@; \
+			fi; \
+			echo "$$line" | sed 'sX<a *id="\(.*\)" *> *</a> *<h3>\(.*20..\), *\(.*\)</h3>X\
     <item>\
         <title>\2, \3</title>\
         <link>http://ffmpeg.org/index.html#\1</link>\
-        <guid>http://ffmpeg.org/index.html#\1</guid>\
-    </item>\
-X' >> $@
+        <guid>http://ffmpeg.org/index.html#\1</guid>X' >> $@; \
+		echo -n '        <content:encoded><![CDATA[' >> $@; \
+		NSTART='yes'; \
+		elif [ $$NSTART ]; then \
+			echo "        $$line" >> $@; \
+		fi; \
+	done < $<
+	echo '        ]]></content:encoded>' >> $@
+	echo '    </item>' >> $@
 	echo '</channel>' >> $@
 	echo '</rss>' >> $@
 
-- 
1.8.4.5



More information about the ffmpeg-devel mailing list