Projects/worblehat-old
Projects
/
worblehat-old
Archived
12
0
Fork 0

fikset litt på gdata-biblioteket

This commit is contained in:
Øyvind Almelid 2010-09-24 21:14:54 +00:00
parent 46398a5b49
commit 6b6f02017a
1 changed files with 12 additions and 2 deletions

View File

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