Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
49 lines (41 sloc) 1.4 KB
# Given a listing of files in an S3 bucket, get the relevant info and create a podcast.xml file from them.
# sample listing
# note: exclude podcast file itself!
date -R | getline d
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
print "<rss version=\"2.0\">"
print "<channel>"
print "<title>My Radio Podcast</title>"
print "<description>Slurped internet radio</description>"
print "<link></link>"
print "<language>en-us</language>"
print "<copyright>Copyright 2013</copyright>"
print "<lastBuildDate>" d "</lastBuildDate>"
print "<pubDate>" d "</pubDate>"
print "<webMaster></webMaster>"
!/podcast\.xml/ {
print "<item>"
line_date = $1" "$2
date_cmd = "date -d \" " $1 " " $2 " -0000\" -R"
date_cmd | getline item_date
size = $3
url = substr($0, index($0,$4)) # get the last n fields
file = url_components[4]
directory = url_components[3]
print "<title>" file "</title>"
print "<link>" url "</link>"
print "<guid>" url "</guid>"
print "<description>" line_date "</description>"
print "<enclosure url=\"" directory "/" file "\" length=\"" size "\" type=\"audio/mpeg\"/>"
print "<category>Podcasts</category>"
print "<pubDate>" item_date "</pubDate>"
print "</item>"
print "</channel>"
print "</rss>"