<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>Voodoo Programming &#187; Google Apps</title>
	<atom:link href="http://www.cneophytou.com/tag/google-apps/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cneophytou.com</link>
	<description>Things programmers do that they know shouldn&#039;t work but they try anyway, and which sometimes actually work, such as recompiling everything.</description>
	<lastBuildDate>Fri, 12 Nov 2010 17:07:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Photo feed as Desktop Background</title>
		<link>http://www.cneophytou.com/2008/04/17/photo-feed-as-desktop-background/</link>
		<comments>http://www.cneophytou.com/2008/04/17/photo-feed-as-desktop-background/#comments</comments>
		<pubDate>Thu, 17 Apr 2008 15:14:57 +0000</pubDate>
		<dc:creator>Constantinos</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[CC Licence]]></category>
		<category><![CDATA[Chromasia]]></category>
		<category><![CDATA[ddoi]]></category>
		<category><![CDATA[Feed]]></category>
		<category><![CDATA[Google Apps]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[RSS]]></category>

		<guid isPermaLink="false">http://www.cneophytou.com/?p=110</guid>
		<description><![CDATA[I first came up with this idea after reading a post on HackerMoJo.com about getting an RSS feed of images as a Screen Saver using a python script. The idea is simple: Take a feed, parse it, and save the photos it links to as numbered images in a folder on the disk, then use [...]]]></description>
			<content:encoded><![CDATA[I first came up with this idea after reading a post on <a href="http://hackermojo.com/mt-static/archives/2008/04/metropulse-launched.html">HackerMoJo.com</a> about getting an RSS feed of images as a Screen Saver using a python script. The idea is simple: Take a feed, parse it, and save the photos it links to as numbered images in a folder on the disk, then use that folder as a Screen Saver. Well, as it turns out you can also use that folder as a desktop background, but there are a few improvements that can be made.<br />
<br />
First, the script only worked with that particular feed. If you wanted to use a different feed, you would have to change the code. Second, the script would always download all the photos linked to from the feed, thus increasing the load placed on the hosting server. I wanted to use the script to download the photos from <a href="http://www.chromasia.com/iblog">Chromasia</a>, which brings me to point number three: some feeds don't link to the large photo, but instead only include a thumbnail. To solve these issues, I created a small application using Google's wonderful <a href="http://code.google.com/appengine/">App Engine</a>, which takes care of everything. More on how to use this after the jump.<br />
<span id="more-110"></span>
<br />
This application takes care of keeping a database of the most recent photos linked to from the provided feeds, thus balancing the load placed on the hosting servers, and also allowing me to serve the feeds in a single standardised format. So far, the script supports the feeds of David Nightingale's <a href="http://www.chromasia.com/iblog">Chromasia</a> who kindly agreed to let me download web-scaled versions of his photos for use with this script and also helped me test early versions of the app, and Sam Javanrouh's <a href="http://wvs.topleftpixel.com/">daily dose of imagery</a>.<br />
<br />
There are several ways to use these feeds. The easiest way is through iPhoto 6 or 7. Just subscribe to the iPhoto photo feed for either chromasia (<a href="http://deskfeed.neophytou.net/feed/chromasia">http://deskfeed.neophytou.net/feed/chromasia</a>) or daily dose of imagery (<a href="http://deskfeed.neophytou.net/feed/ddoi">http://deskfeed.neophytou.net/feed/ddoi</a>). There are three down sides to using this method: You have to open iPhoto every day to refresh the feeds manually, every time iPhoto refreshes it has to download all the photos over again, and you can only use the photos from a single feed, not multiple ones. Also in Tiger, I believe you can only use an iPhoto photo feed as a Screen Saver, not as a Desktop Background.<br />
<br />
The other way to use this application, is through a small Python script which I wrote. To use this, you need to create a folder called DeskFeed inside the Pictures folder located in your Home directory (resulting path: ~/Pictures/DeskFeed, where ~/ is your home directory). Then, <a href='http://www.cneophytou.com/wp-content/uploads/2008/04/deskfeed.py'>download this script</a> into the folder you just created, and run the following commands in the Terminal (found under <code>Applications/Utilities/Terminal</code>):</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> a+x ~<span style="color: #000000; font-weight: bold;">/</span>Pictures<span style="color: #000000; font-weight: bold;">/</span>DeskFeed<span style="color: #000000; font-weight: bold;">/</span>deskfeed.py
~<span style="color: #000000; font-weight: bold;">/</span>Pictures<span style="color: #000000; font-weight: bold;">/</span>DeskFeed<span style="color: #000000; font-weight: bold;">/</span>deskfeed.py</pre></div></div>



<p>
This will automatically download the latest photos from the Chromasia and daily dose of imagery blogs, and save them in the DeskFeed folder. To modify which feeds are downloaded (or not), open the deskfeed.py file you just downloaded and comment out / uncomment the photo feeds you want on the first few lines that are clearly marked. You can have as many feeds as you want in the script, but they have to be generated from the App Engine script which I wrote.<br />
<br />
To set this up as a periodic task using <code>cron</code>, create a text file on your desktop called <code>dfcron</code>, and in it place this single line:</p>


<div class="wp_syntax"><div class="code"><pre class="cron" style="font-family:monospace;">5      1       *       *       *       /Users/username/Pictures/DeskFeed/deskfeed.py</pre></div></div>



<p>
Make sure you replace <code>username</code> with your own short username. What this file contains is a command that will tell <code>cron</code> to run the <code>deskfeed.py</code> file every day at 5 minutes past 1am. Then, run this command in the terminal once:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">crontab ~<span style="color: #000000; font-weight: bold;">/</span>Desktop<span style="color: #000000; font-weight: bold;">/</span>dfcron</pre></div></div>



<p>
You can now safely delete dfcron. To set this folder as your desktop background, go to System Preferences / Desktop &amp; Screen Saver, press the little '+' button under the list of folders, navigate to the DeskFeed folder, and select Choose. I found that "Fit to Screen" with a black background works best.<br />
<br />
I am open to suggestions about what other photo feeds to include in this application, it only takes about 10 minutes to add a new feed. Furthermore, I will be creating a more solid application that will be customisable through preferences rather than relying on a Python script. But as this is a first attempt, I'm publishing the code to the script to see if anyone else has any suggestions for improvement. If you just want to look at the code used instead of downloading the above file, here it is:</p>


<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/env python</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">md5</span>
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">urllib</span> <span style="color: #ff7700;font-weight:bold;">import</span> URLopener
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">urllib2</span> <span style="color: #ff7700;font-weight:bold;">import</span> urlopen
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">xml</span>.<span style="color: black;">dom</span>.<span style="color: black;">minidom</span> <span style="color: #ff7700;font-weight:bold;">import</span> parseString
&nbsp;
rss_feeds = <span style="color: black;">&#123;</span><span style="color: black;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#</span>
<span style="color: #808080; font-style: italic;"># Comment / Uncomment the following lines to use the required feeds</span>
<span style="color: #808080; font-style: italic;">#</span>
rss_feeds<span style="color: black;">&#91;</span><span style="color: #483d8b;">'chromasia'</span><span style="color: black;">&#93;</span> = <span style="color: #483d8b;">'http://deskfeed.neophytou.net/rss/chromasia'</span>
rss_feeds<span style="color: black;">&#91;</span><span style="color: #483d8b;">'ddoi'</span><span style="color: black;">&#93;</span> = <span style="color: #483d8b;">'http://deskfeed.neophytou.net/rss/ddoi'</span>
&nbsp;
dst_dir = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">expanduser</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'~/Pictures/DeskFeed/'</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Based on script found at HackerMoJo.com</span>
<span style="color: #808080; font-style: italic;"># http://hackermojo.com/mt-static/archives/2008/04/metropulse-launched.html</span>
<span style="color: #ff7700;font-weight:bold;">def</span> parseFeed<span style="color: black;">&#40;</span>rss<span style="color: black;">&#41;</span>:
  <span style="color: #ff7700;font-weight:bold;">try</span>:
    rss_contents = urlopen<span style="color: black;">&#40;</span> rss <span style="color: black;">&#41;</span>
  <span style="color: #ff7700;font-weight:bold;">except</span>:
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Failed to read rss feed %s&quot;</span> <span style="color: #66cc66;">%</span> rss
    <span style="color: #ff7700;font-weight:bold;">return</span>
  rss_src = rss_contents.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
  rss_contents.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
  dom = parseString<span style="color: black;">&#40;</span> rss_src <span style="color: black;">&#41;</span>
  node_lst = dom.<span style="color: black;">getElementsByTagName</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'item'</span><span style="color: black;">&#41;</span>
  items = <span style="color: #008000;">range</span><span style="color: black;">&#40;</span>node_lst.<span style="color: black;">length</span><span style="color: black;">&#41;</span>
  hashes = <span style="color: black;">&#123;</span><span style="color: black;">&#125;</span>
  group = node_lst.<span style="color: black;">item</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span>.<span style="color: black;">getElementsByTagName</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'title'</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">getAttribute</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'group'</span><span style="color: black;">&#41;</span>
  <span style="color: #808080; font-style: italic;"># Store the md5 hashes of all the saved photos</span>
  <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> items:
    img_filename = <span style="color: #483d8b;">&quot;%s%s_%s.jpg&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>dst_dir,group,i<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">try</span>:
      image_file = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>img_filename, <span style="color: #483d8b;">&quot;r&quot;</span><span style="color: black;">&#41;</span>
      hashes<span style="color: black;">&#91;</span>img_filename<span style="color: black;">&#93;</span> = <span style="color: #dc143c;">md5</span>.<span style="color: #dc143c;">md5</span><span style="color: black;">&#40;</span>image_file.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>.<span style="color: black;">hexdigest</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
      image_file.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">IOError</span>:
      hashes<span style="color: black;">&#91;</span>img_filename<span style="color: black;">&#93;</span> = <span style="color: #483d8b;">&quot;&quot;</span>
      <span style="color: #ff7700;font-weight:bold;">pass</span>
  <span style="color: #808080; font-style: italic;"># Go through all the photos in the rss feed, in reverse order</span>
  items.<span style="color: black;">reverse</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
  <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> items:
    element = node_lst.<span style="color: black;">item</span><span style="color: black;">&#40;</span>i<span style="color: black;">&#41;</span>
    group = element.<span style="color: black;">getElementsByTagName</span><span style="color: black;">&#40;</span> <span style="color: #483d8b;">'title'</span> <span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">getAttribute</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'group'</span><span style="color: black;">&#41;</span>
    link = element.<span style="color: black;">getElementsByTagName</span><span style="color: black;">&#40;</span> <span style="color: #483d8b;">'link'</span> <span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">getAttribute</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'source'</span><span style="color: black;">&#41;</span>
    photo_hash = element.<span style="color: black;">getElementsByTagName</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'hash'</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">firstChild</span>.<span style="color: black;">data</span>
    img_filename = <span style="color: #483d8b;">&quot;%s%s_%s.jpg&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>dst_dir, group, i<span style="color: black;">&#41;</span>
    <span style="color: #808080; font-style: italic;"># Check all the saved photos and see if any of them have the same hash</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> j <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span>i<span style="color: black;">&#41;</span>:
      old_img_filename = <span style="color: #483d8b;">&quot;%s%s_%s.jpg&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>dst_dir, group, j<span style="color: black;">&#41;</span>
      <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span>hashes<span style="color: black;">&#91;</span>old_img_filename<span style="color: black;">&#93;</span> == photo_hash<span style="color: black;">&#41;</span>:
        <span style="color: #808080; font-style: italic;"># If one does, give it the current photo filename</span>
        <span style="color: #dc143c;">os</span>.<span style="color: black;">system</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;mv %s %s&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>old_img_filename, img_filename<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
        hashes<span style="color: black;">&#91;</span>old_img_filename<span style="color: black;">&#93;</span> = <span style="color: #483d8b;">&quot;&quot;</span>
        hashes<span style="color: black;">&#91;</span>img_filename<span style="color: black;">&#93;</span> = photo_hash
        <span style="color: #ff7700;font-weight:bold;">break</span>
    <span style="color: #ff7700;font-weight:bold;">try</span>:
      image_file = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>img_filename, <span style="color: #483d8b;">&quot;r&quot;</span><span style="color: black;">&#41;</span>
      old_hash = <span style="color: #dc143c;">md5</span>.<span style="color: #dc143c;">md5</span><span style="color: black;">&#40;</span>image_file.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>.<span style="color: black;">hexdigest</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
      image_file.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
      <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span>old_hash == photo_hash<span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">continue</span>
    <span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">IOError</span>:
      <span style="color: #ff7700;font-weight:bold;">pass</span>
    <span style="color: #ff7700;font-weight:bold;">try</span>:
      URLopener<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">retrieve</span><span style="color: black;">&#40;</span>link, img_filename<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">IOError</span>:
      <span style="color: #ff7700;font-weight:bold;">continue</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
  <span style="color: #ff7700;font-weight:bold;">for</span> key <span style="color: #ff7700;font-weight:bold;">in</span> rss_feeds:
    parseFeed<span style="color: black;">&#40;</span>rss_feeds<span style="color: black;">&#91;</span>key<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">&quot;__main__&quot;</span>:
  main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>



<p>
<a href='http://www.cneophytou.com/wp-content/uploads/2008/04/deskfeed.py'>Download this script</a><br />
<br />
That's pretty much it. As you can see, the script is not that complicated, and I can very easily modify the way the photos are served to the clients. This code has been tested under Leopard using Python 2.5, but also under Ubuntu using Python 2.4.3, and I believe it should also work under Tiger using Python 2.3, but I could very well be wrong. So as always, I'm open to feedback and suggestions. If anyone knows how to create a Preference pane, please contact me. I know exactly what needs to be done in the Preference pane, but I have no idea how to use Xcode.]]></content:encoded>
			<wfw:commentRss>http://www.cneophytou.com/2008/04/17/photo-feed-as-desktop-background/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Downloading your code from Google App Engine</title>
		<link>http://www.cneophytou.com/2008/04/17/downloading-your-code-from-google-app-engine/</link>
		<comments>http://www.cneophytou.com/2008/04/17/downloading-your-code-from-google-app-engine/#comments</comments>
		<pubDate>Thu, 17 Apr 2008 14:42:23 +0000</pubDate>
		<dc:creator>Constantinos</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Google Apps]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.cneophytou.com/?p=112</guid>
		<description><![CDATA[I've started using Google's App Engine since it launched, mostly playing around with Python (always wanted to learn), and setting up a small app to deal with my Desktop Photo Feed script. One irritation I had was that I wanted to share my code with a friend, but the app engine doesn't provide any way [...]]]></description>
			<content:encoded><![CDATA[I've started using Google's <a href="http://appengine.google.com/">App Engine</a> since it launched, mostly playing around with Python (always wanted to learn), and setting up a small app to deal with my <a href="http://www.cneophytou.com/2008/04/17/photo-feed-as-desktop-background/">Desktop Photo Feed</a> script. One irritation I had was that I wanted to share my code with a friend, but the app engine doesn't provide any way of downloading the source code.<br />
<br />
One way around this that I found, was a blog post by <a href="http://david-burger.blogspot.com/">David Burger</a> on <a href="http://david-burger.blogspot.com/2008/04/download-your-code-from-google-app.html">Download Your Code from Google App Engine</a>, where he created a Makefile to do the dirtywork. Because I don't like Makefiles (and have it from good authority that Googlers hate Makefiles too, but that's besides the point - just to reinforce my position), I modified his method to make it slightly more versatile so that it can work well with OS X (<code>tar</code> includes ._* resource fork files which are annoying), and also turn it into a shell script.<br />
<span id="more-112"></span>
<br />
There are two steps to the process. First, save this code as a file called something like <code>update.sh</code> in the base folder where your app code is located, and make it executable:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">ARCHIVE_DIR</span>=archive
<span style="color: #007800;">ARCHIVE_NAME</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">basename</span> <span style="color: #007800;">$PWD</span><span style="color: #000000; font-weight: bold;">`</span>.tgz
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> <span style="color: #800000;">${ARCHIVE_DIR}</span>
<span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;*~&quot;</span> <span style="color: #660033;">-delete</span>
<span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;*pyc&quot;</span> <span style="color: #660033;">-delete</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">COPY_EXTENDED_ATTRIBUTES_DISABLE</span>=<span style="color: #c20cb9; font-weight: bold;">true</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">COPYFILE_DISABLE</span>=<span style="color: #c20cb9; font-weight: bold;">true</span>
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-czf</span> <span style="color: #800000;">${ARCHIVE_NAME}</span> <span style="color: #660033;">--exclude</span> .DS_Store <span style="color: #660033;">--exclude</span> <span style="color: #800000;">${ARCHIVE_NAME}</span> <span style="color: #660033;">-C</span> ..<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">basename</span> <span style="color: #007800;">$PWD</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #800000;">${ARCHIVE_DIR}</span>
<span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #800000;">${ARCHIVE_NAME}</span> <span style="color: #800000;">${ARCHIVE_DIR}</span>
appcfg.py update .<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>



<p>
<a href='http://www.cneophytou.com/wp-content/uploads/2008/04/update.sh'>Download this script</a><br />
<br />
Then, you would probably want to password protect the resource that points to this archive file, so add this to your <code>app.yaml</code> file:</p>


<div class="wp_syntax"><div class="code"><pre class="yaml" style="font-family:monospace;">- url: /archive
  static_dir: archive
  login: admin</pre></div></div>



<p>
Now, whenever you wish to update your app, just execute <code>./update.sh</code> instead of <code>./appcfg.py update ./</code>, and the archive of your source will be created and uploaded with your changes. To download, assuming the folder your application is in has the same name as your application, just visit <code>http://yourapp.appspot.com/archive/yourapp.tgz</code> where <code>yourapp</code> is your app's name, and <code>yourapp.tgz</code> is your app folder's name if it's different from your app's name, and you will be prompted to download the archive assuming you're logged in as administrator. That's it!]]></content:encoded>
			<wfw:commentRss>http://www.cneophytou.com/2008/04/17/downloading-your-code-from-google-app-engine/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

