fikset litt på gdata-biblioteket
This commit is contained in:
parent
46398a5b49
commit
6b6f02017a
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
from web.library.models import *
|
from web.library.models import *
|
||||||
from gdata.books.service import BookService
|
from gdata.books.service import BookService
|
||||||
|
from xml.dom import minidom
|
||||||
import re
|
import re
|
||||||
|
|
||||||
exit_commands = ['exit', 'abort', 'quit', 'bye', 'eat flaming death', 'q']
|
exit_commands = ['exit', 'abort', 'quit', 'bye', 'eat flaming death', 'q']
|
||||||
|
@ -37,8 +38,9 @@ def build_book(entry, input=False):
|
||||||
else:
|
else:
|
||||||
print "No ISBN found"
|
print "No ISBN found"
|
||||||
return False
|
return False
|
||||||
if 'description' in dic:
|
# if 'description' in dic:
|
||||||
b.description = dic['description']
|
# b.description = dic['description']
|
||||||
|
b.description = find_description(entry)
|
||||||
if 'date' in dic:
|
if 'date' in dic:
|
||||||
b.published_year = int(dic['date'][:4])
|
b.published_year = int(dic['date'][:4])
|
||||||
if 'publishers' in dic:
|
if 'publishers' in dic:
|
||||||
|
@ -46,6 +48,14 @@ def build_book(entry, input=False):
|
||||||
b.num_pages = find_page_number(dic)
|
b.num_pages = find_page_number(dic)
|
||||||
b.full_print()
|
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):
|
def find_page_number(dic):
|
||||||
if 'format' in dic:
|
if 'format' in dic:
|
||||||
for item in dic['format']:
|
for item in dic['format']:
|
||||||
|
|
Reference in New Issue