From 6b6f02017a1f34a26d07987314fe27f2170ffec0 Mon Sep 17 00:00:00 2001 From: almelid Date: Fri, 24 Sep 2010 21:14:54 +0000 Subject: [PATCH] =?UTF-8?q?fikset=20litt=20p=C3=A5=20gdata-biblioteket?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python/google_interface.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/python/google_interface.py b/python/google_interface.py index 56218a6..0a7de76 100644 --- a/python/google_interface.py +++ b/python/google_interface.py @@ -2,6 +2,7 @@ from web.library.models import * from gdata.books.service import BookService +from xml.dom import minidom import re exit_commands = ['exit', 'abort', 'quit', 'bye', 'eat flaming death', 'q'] @@ -37,8 +38,9 @@ def build_book(entry, input=False): else: print "No ISBN found" return False - if 'description' in dic: - b.description = dic['description'] +# if 'description' in dic: +# b.description = dic['description'] + b.description = find_description(entry) if 'date' in dic: b.published_year = int(dic['date'][:4]) if 'publishers' in dic: @@ -46,6 +48,14 @@ def build_book(entry, input=False): b.num_pages = find_page_number(dic) b.full_print() +def find_description(entry): + if entry.description: + d = minidom.parseString(str(entry.description)) + print d.childNodes[0].childNodes[0].data + return "" + else: + return "" + def find_page_number(dic): if 'format' in dic: for item in dic['format']: