Created
June 26, 2011 21:21
-
-
Save MasterEx/1047986 to your computer and use it in GitHub Desktop.
Shell RSS writer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<rss version="2.0"> | |
<channel> | |
<title>yo</title> | |
<link>http://www.google.com</link> | |
<description>hello wold</description> | |
<language>en-us</language> | |
<generator>just a shell script rss writer</generator> | |
<item> | |
<title>AUEB FOSS COMMUNITY</title> | |
<link>http://foss.aueb.gr</link> | |
<description>awesome foss stuff!</description> | |
<category>open source</category> | |
<category>free software</category> | |
</item> | |
<item> | |
<title>MasterEx @ GitHub</title> | |
<link>https://github.com/MasterEx</link> | |
<description>social coding!</description> | |
<author>Periklis Ntanasis</author> | |
<category>code repo</category> | |
</item> | |
</channel> | |
</rss> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
### Created by Periklis Master_ex Ntanasis ### | |
### https://gist.github.com/gists/1047986 ### | |
# global variables | |
FILE="deafult.rss" | |
function open { | |
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?> | |
<rss xmlns:atom=\"http://www.w3.org/2005/Atom\" version=\"2.0\"> | |
<channel> | |
<atom:link href=\"$1\" rel=\"self\" type=\"application/rss+xml\"/> | |
<title>$2</title> | |
<link>$3</link> | |
<description>$4</description>" > $FILE | |
} | |
function close { | |
echo " </channel> | |
</rss>" >> $FILE | |
} | |
#don't forget to set description | |
function oitem { | |
echo " <item> | |
<title>$1</title> | |
<link>$2</link> | |
<description>$description</description>">> $FILE | |
} | |
function citem { | |
echo " </item>">> $FILE | |
} | |
function language { | |
echo " <language>$1</language>">> $FILE | |
} | |
function copyright { | |
echo " <copyright>$1</copyright>">> $FILE | |
} | |
function managingEditor { | |
echo " <managingEditor>$1</managingEditor>">> $FILE | |
} | |
function webMaster { | |
echo " <webMaster>$1</webMaster>">> $FILE | |
} | |
function pubDate { | |
echo " <pubDate>$1</pubDate>">> $FILE | |
} | |
function lastBuildDate { | |
echo " <lastBuildDate>$1</lastBuildDate>">> $FILE | |
} | |
function category { | |
echo " <category>$1</category>">> $FILE | |
} | |
function generator { | |
echo " <generator>$1</generator>">> $FILE | |
} | |
function docs { | |
echo " <docs>$1</docs>">> $FILE | |
} | |
function cloud { | |
echo " <cloud domain=\"$1\" port=\"$2\" path=\"$3\" registerProcedure=\"$4\" protocol=\"$5\" />">> $FILE | |
} | |
function ttl { | |
echo " <ttl>$1</ttl>">> $FILE | |
} | |
function image { | |
echo " <image> | |
<url>$1</url> | |
<title>$2</title> | |
<link>$3</link> | |
</image>">> $FILE | |
} | |
function rating { | |
echo " <rating>$1</rating>">> $FILE | |
} | |
function textInput { | |
echo " <textInput> | |
<title>$1</title> | |
<description>$2</description> | |
<name>$3</name> | |
<link>$4</link> | |
</textInput>">> $FILE | |
} | |
function skipHours { | |
echo " <skipHours>$1</skipHours>">> $FILE | |
} | |
function skipDays { | |
echo " <skipDays>$1</skipDays>">> $FILE | |
} | |
function author { | |
echo " <author>$1</author>">> $FILE | |
} | |
function category { | |
echo " <category>$1</category>">> $FILE | |
} | |
function categoryd { | |
echo " <category domain=\"$1\">$2</category>">> $FILE | |
} | |
function comments { | |
echo " <comments>$1</comments>">> $FILE | |
} | |
function enclosure { | |
echo " <enclosure>$1</enclosure>">> $FILE | |
} | |
function guid { | |
echo " <guid>$1</guid>">> $FILE | |
} | |
function ipubDate { | |
echo " <pubDate>$1</pubDate>">> $FILE | |
} | |
function source { | |
echo " <source>$1</source>">> $FILE | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
. rsswriter.sh | |
FILE="output.rss" | |
open http://www.google.com/file.rss yo http://www.google.com "hello wold" | |
language "en-us" | |
generator "just a shell script rss writer" | |
oitem "AUEB FOSS COMMUNITY" http://foss.aueb.gr "awesome foss stuff!" | |
category "open source" | |
category "free software" | |
citem | |
oitem "MasterEx @ GitHub" https://github.com/MasterEx "social coding!" | |
author "Periklis Ntanasis" | |
category "code repo" | |
citem | |
close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment