#! /bin/bash

# cat atom-header.xml > atom.xml

echo "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" > atom.xml
echo "<?xml-stylesheet href=\"http://www.blogger.com/styles/atom.css\" type=\"text/css\"?>" >> atom.xml
echo "" >> atom.xml
echo "<feed version=\"0.3\" xmlns=\"http://purl.org/atom/ns#\">" >> atom.xml
echo "<link href=\"http://www.blogger.com/atom/3808484\" rel=\"service.post\" title=\"photo library\" type=\"application/x.atom+xml\"/>" >> atom.xml
echo "<link href=\"http://www.blogger.com/atom/3808484\" rel=\"service.feed\" title=\"photo library\" type=\"application/x.atom+xml\"/>" >> atom.xml
echo "<title mode=\"escaped\" type=\"text/html\">photo library</title>" >> atom.xml
echo "<tagline mode=\"escaped\" type=\"text/html\">Alomst every picture I have ever taken with my digital camera</tagline>" >> atom.xml
echo "<link href=\"http://www.celesteh.com/pics/pics.html\" rel=\"alternate\" title=\"photo library\" type=\"text/html\"/>" >> atom.xml
echo "<id>tag:blogger.com,1999:blog-3808484</id>" >> atom.xml
echo "<modified>" >> atom.xml
date +'%FT%H:%M:00Z' >> atom.xml
echo "</modified>" >> atom.xml
echo "<generator url=\"http://www.blogger.com/\" version=\"5.15\">Blogger</generator>" >> atom.xml
echo "<info mode=\"xml\" type=\"text/html\">" >> atom.xml
echo "<div xmlns=\"http://www.w3.org/1999/xhtml\">This is an Atom formatted XML site feed. It is intended to be viewed in a Newsreader or syndicated to another site. Please visit the <a href=\"http://help.blogger.com/bin/answer.py?answer=697\">Blogger Knowledge Base</a> for more info.</div>" >> atom.xml
echo "</info>" >> atom.xml


echo "<entry>" > new_atom.xml
echo "<author>" >> new_atom.xml
echo "<name>Celesteh</name>" >> new_atom.xml
echo "</author>" >> new_atom.xml
echo "<issued>" >> new_atom.xml
date +'%FT%H:%M:00-07:00' >> new_atom.xml
echo "</issued>" >> new_atom.xml
echo "<created>" >> new_atom.xml
date +'%FT%H:%M:00Z' >> new_atom.xml
echo "</created>" >> new_atom.xml
#img = $2
#$img = $img - 1
let "img = $2 - 1"

#let "link = \"New pictures up in Celeste's photo library\""

echo "<link href=\"http://www.celesteh.com/pics/$1/$1-Pages/Image$img.html\" rel=\"alternative\" title=\"New Pictures\" type=\"text/html\" />" >> new_atom.xml

echo "<id>tag:xkey.com,1999:blog-3808484.post-10911463390611$1$img</id>" >> new_atom.xml

echo "<title mode=\"escaped\" type=\"text/html\">New Pictures</title>" >> new_atom.xml

echo "<content mode=\"escaped\" type=\"text/html\" xml:base=\"http://www.celesteh.com/pics/pics.html\" xml:lang=\"en-US\" xml:space=\"preserve\">"  >> new_atom.xml

echo "<div xmlns=\"http://www.w3.org/1999/xhtml\">" >> new_atom.xml

echo "&lt;p&gt;" >> new_atom.xml

echo "&lt;a href=\"http://www.celesteh.com/pics/$1/$1-Pages/Image$img.html\"&gt;" >> new_atom.xml
echo "&lt;img src=\"http://www.celesteh.com/pics/$1/$1-Images/$img.jpg\"&gt;&lt;br /&gt;" >> new_atom.xml
echo "${3:-"New pictures up in Celeste's photo library"}&lt;/a&gt;&lt;/p&gt;" >> new_atom.xml

echo "</div>" >> new_atom.xml

echo "</content>" >> new_atom.xml

echo "</entry>" >> new_atom.xml

cat old_atom.xml >> new_atom.xml
cat new_atom.xml >> atom.xml
mv new_atom.xml old_atom.xml

