Posts Tagged ‘json’
* Calibre Week In Review
Posted on January 10th, 2010 by John. Filed under calibre.
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.
While it’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’t use too much space to store it. Right now it’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.
* json and blogger
Posted on December 14th, 2008 by John. Filed under programming.
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’s blogger api to get the data.
*** Updated to account for non numeric input when setting max entries.
import simplejson import sys import urllib2 def usage(): print sys.argv[0], 'blogname [max-results]' print ' Gets blog updates from blogger.com' if len(sys.argv) 3: usage() sys.exit(2) try: blogname = sys.argv[1] except: print "Sorry:", sys.exec_type, ":", sys.exec_value sys.exit(1) max_results = 5 if len(sys.argv) is 3: try: max_results = int(sys.argv[2]) except: pass try: json_data = simplejson.load(urllib2.urlopen('http://%s.blogspot.com/feeds/posts/default?alt=json&orderby=published&sortorder=ascending&max-results=%i' % (blogname, max_results))) except: print "Sorry:", sys.exc_type, ":", sys.exc_value sys.exit(1) for entry in json_data['feed']['entry']: print 'Title: %s' % (entry['title']['$t']) print 'Author: %s' % (entry['author'][0]['name']['$t']) print 'Published: %s' % (entry['published']['$t']) print 'Content: %s' % (entry['content']['$t']) print ''
Tags
Archives
- July 2010 (4)
- June 2010 (1)
- May 2010 (2)
- March 2010 (1)
- January 2010 (8)
- December 2009 (5)
- November 2009 (6)
- October 2009 (4)
- September 2009 (2)
- August 2009 (6)
- July 2009 (6)
- June 2009 (4)
- May 2009 (6)
- April 2009 (4)
- March 2009 (2)
- February 2009 (4)
- January 2009 (4)
- December 2008 (7)
- November 2008 (2)