|
As I use my Zaurus PDA to stream radio & other audio content I missed a convinient way to have access to podcasts. My first attempt to overcome this problem was the podcast to .m3u xslt; but the available audioplayers did not process the playlist to my satisfaction. So I created this script/xslt, which converts a podcast to a shell script.
XSLT: <?xml version="1.0" encoding="ISO-8859-1"?> <!-- **************************************************** * (c) 2007 by CodeOmega (tm), Patrik Gfeller (pgf) * **************************************************** Version: 1.01 --> <xsl:stylesheet version = '1.0' xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"> <!-- we emit plain text (w/o the <?xml > header) --> <xsl:output method="text"/>
<xsl:template match="channel"> #!/bin/sh echo "***" echo "*" <xsl:value-of select="title" /> echo "***" echo <xsl:value-of select="description" /> echo " " <!-- Display Metainfo about the available casts, this will also serve as the selection screen. --> <xsl:for-each select="item"> echo -n <xsl:value-of select="position()"/> echo -n " : " <xsl:variable name="tmp1" select="itunes:subtitle"/> <!-- This is a temporary workarround to get rid of unwanted characters, we need a string replace function - as to encode them would be much better, than just "killing" them ... --> <xsl:variable name="tmp2" select="translate($tmp1, '(', ' ')"/> <xsl:variable name="var" select="translate($tmp2, ')', ' ')"/>
echo <xsl:value-of select="$var" /> - \(<xsl:value-of select="substring(itunes:duration,4,2)" /> min. <xsl:value-of select="substring(itunes:duration,8,2)" /> s.\) </xsl:for-each> echo echo -n " => " read selection <!-- --> case "$selection" in <xsl:for-each select="item"> <xsl:value-of select="position()" />) mplayer <xsl:value-of select="./guid" /> ;; </xsl:for-each> esac </xsl:template>
<xsl:strip-space elements="*"/> </xsl:stylesheet>
A small script to invoke xsltproc: #!/bin/sh clear xsltproc podcast2sh.xsl $1 > play.sh chmod 755 play.sh ./play.sh
Example: #> ./podcast.sh http://pod.drs.ch/mailbox_mpx.xml
*** * Mailbox *** Mailbox Mo-Fr 11.40-11.45, DRS 1 Die Mailbox gibt Antworten auf die alltäglichen Fragen, die wir uns immer wieder stellen. Weshalb funktioniert etwas so und nicht anders? Wir verraten Hintergründe, technische Geheimnisse und interessante Zusammenhänge. Schicken Sie uns Ihre Fragen. Mail senden Die Mailbox gibt es auch als Podcast. So bekommen Sie die Sendung jeden Tag auf Ihren Computer geladen und können sie auf Ihren mp3-Player in aller Ruhe hören, wann und wo Sie wollen.
1 : Wie funktioniert die Tastatur eines chinesischen Computers? - (05 min. 0 s.) 2 : Was geschieht beim Stimmbruch? - (05 min. 0 s.) 3 : Woher stammt der Begriff «Lausbub»? - (05 min. 0 s.) 4 : Wo liegt der Unterschied zwischen «fliehen» und «flüchten»? - (05 min. 0 s.) 5 : Wie erklärt sich der Ausdruck «Jemand hat es faustdick hinter den Ohren»? - (05 min. 0 s.)
=>
|