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']: