<?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/"
	>

<channel>
	<title>John&#039;s Blog &#187; json</title>
	<atom:link href="http://john.nachtimwald.com/tag/json/feed/" rel="self" type="application/rss+xml" />
	<link>http://john.nachtimwald.com</link>
	<description>My little blog</description>
	<lastBuildDate>Sat, 31 Jul 2010 17:28:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Calibre Week In Review</title>
		<link>http://john.nachtimwald.com/2010/01/10/calibre-week-in-review-23/</link>
		<comments>http://john.nachtimwald.com/2010/01/10/calibre-week-in-review-23/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 23:30:34 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[calibre]]></category>
		<category><![CDATA[device interfaces]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[prs]]></category>

		<guid isPermaLink="false">http://john.nachtimwald.com/?p=341</guid>
		<description><![CDATA[Kovid just tagged the 0.6.33 release so it should be out the door later today. Only one major feature from me this week. The PRS driver can new customize what gets turned into a collection. The default was and is series and tags. Now under the device interface configuration you can specify any metadata field. [...]]]></description>
			<content:encoded><![CDATA[<p>Kovid just tagged the 0.6.33 release so it should be out the door later today. Only one major feature from me this week. The PRS driver can new customize what gets turned into a collection. The default was and is series and tags. Now under the device interface configuration you can specify any metadata field. The main use for this change is so people who have a large number of tags can disable collections being created from them.</p>
<p>While it&#8217;s not coming out today I have been working on a major feature. Metadata caching for devices. Basically a file that specifies all of the metadata for the books on the reader will be created. It will be used when the device is connected and if any files have changed their metadata will be updated. This  speeds up device detection dramatically. Also, takes up less space than a book so it won&#8217;t use too much space to store it. Right now it&#8217;s storing the data using json so other application can have easy access to the data too. Other than faster device detection this is the ground work that is required to implement syncing.</p>
]]></content:encoded>
			<wfw:commentRss>http://john.nachtimwald.com/2010/01/10/calibre-week-in-review-23/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>json and blogger</title>
		<link>http://john.nachtimwald.com/2008/12/14/json-and-blogger/</link>
		<comments>http://john.nachtimwald.com/2008/12/14/json-and-blogger/#comments</comments>
		<pubDate>Mon, 15 Dec 2008 03:05:08 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://john.nachtimwald.com/?p=15</guid>
		<description><![CDATA[Today I decided to learn about json. To help me with this I coded a little python script I call blogger-updates.py. It takes the name of a blogger blog and optionally a number designating the number of entries to reterieve. I used Google&#8217;s blogger api to get the data. *** Updated to account for non [...]]]></description>
			<content:encoded><![CDATA[<p>Today I decided to learn about <a href="http://json.org/">json</a>. To help me with this I coded a little python script I call blogger-updates.py. It takes the name of a blogger blog and optionally a number designating the number of entries to reterieve. I used Google&#8217;s blogger api to get the data.</p>
<p>*** Updated to account for non numeric input when setting max entries.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> simplejson
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">urllib2</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> usage<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>, <span style="color: #483d8b;">'blogname [max-results]'</span>
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'    Gets blog updates from blogger.com'</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#41;</span>  <span style="color: #ff4500;">3</span>:
    usage<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #dc143c;">sys</span>.<span style="color: black;">exit</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">try</span>:
    blogname = <span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>
<span style="color: #ff7700;font-weight:bold;">except</span>:
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Sorry:&quot;</span>, <span style="color: #dc143c;">sys</span>.<span style="color: black;">exec_type</span>, <span style="color: #483d8b;">&quot;:&quot;</span>, <span style="color: #dc143c;">sys</span>.<span style="color: black;">exec_value</span>
    <span style="color: #dc143c;">sys</span>.<span style="color: black;">exit</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>
&nbsp;
max_results = <span style="color: #ff4500;">5</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">is</span> <span style="color: #ff4500;">3</span>:
    <span style="color: #ff7700;font-weight:bold;">try</span>:
        max_results = <span style="color: #008000;">int</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">except</span>:
        <span style="color: #ff7700;font-weight:bold;">pass</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">try</span>:
    json_data = simplejson.<span style="color: black;">load</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">urllib2</span>.<span style="color: black;">urlopen</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'http://%s.blogspot.com/feeds/posts/default?alt=json&amp;orderby=published&amp;sortorder=ascending&amp;max-results=%i'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>blogname, max_results<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><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;Sorry:&quot;</span>, <span style="color: #dc143c;">sys</span>.<span style="color: black;">exc_type</span>, <span style="color: #483d8b;">&quot;:&quot;</span>, <span style="color: #dc143c;">sys</span>.<span style="color: black;">exc_value</span>
    <span style="color: #dc143c;">sys</span>.<span style="color: black;">exit</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">for</span> entry <span style="color: #ff7700;font-weight:bold;">in</span> json_data<span style="color: black;">&#91;</span><span style="color: #483d8b;">'feed'</span><span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'entry'</span><span style="color: black;">&#93;</span>:
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'Title: %s'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>entry<span style="color: black;">&#91;</span><span style="color: #483d8b;">'title'</span><span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'$t'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'Author: %s'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>entry<span style="color: black;">&#91;</span><span style="color: #483d8b;">'author'</span><span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'name'</span><span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'$t'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'Published: %s'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>entry<span style="color: black;">&#91;</span><span style="color: #483d8b;">'published'</span><span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'$t'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'Content: %s'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>entry<span style="color: black;">&#91;</span><span style="color: #483d8b;">'content'</span><span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'$t'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">''</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://john.nachtimwald.com/2008/12/14/json-and-blogger/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
