dont download available books, parse worldcat covers

This commit is contained in:
j 2014-05-24 23:21:03 +02:00
parent a1833cc937
commit d96d4300c2
2 changed files with 7 additions and 3 deletions

View file

@ -345,12 +345,10 @@ class Item(db.Model):
def queue_download(self):
u = state.user()
t = Transfer.get_or_create(self.id)
if not u in self.users:
t = Transfer.get_or_create(self.id)
logger.debug('queue %s for download', self.id)
self.users.append(u)
else:
logger.debug('%s already queued for download? %s %s', self.id, t.progress, t.added)
def save_file(self, content):
u = state.user()

View file

@ -62,6 +62,12 @@ def lookup(id):
data['isbn'] = []
if isbn not in data['isbn']:
data['isbn'].append(isbn)
cover = doc.xpath('//img[@class="cover"]')
if cover:
data['cover'] = cover[0].attrib['src']
if data['cover'].startswith('//'):
data['cover'] = 'http:' + data['cover']
if 'author' in data:
data['author'] = [data['author']]
if 'title' in data: