dont download available books, parse worldcat covers
This commit is contained in:
parent
a1833cc937
commit
d96d4300c2
2 changed files with 7 additions and 3 deletions
|
@ -345,12 +345,10 @@ class Item(db.Model):
|
||||||
|
|
||||||
def queue_download(self):
|
def queue_download(self):
|
||||||
u = state.user()
|
u = state.user()
|
||||||
t = Transfer.get_or_create(self.id)
|
|
||||||
if not u in self.users:
|
if not u in self.users:
|
||||||
|
t = Transfer.get_or_create(self.id)
|
||||||
logger.debug('queue %s for download', self.id)
|
logger.debug('queue %s for download', self.id)
|
||||||
self.users.append(u)
|
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):
|
def save_file(self, content):
|
||||||
u = state.user()
|
u = state.user()
|
||||||
|
|
|
@ -62,6 +62,12 @@ def lookup(id):
|
||||||
data['isbn'] = []
|
data['isbn'] = []
|
||||||
if isbn not in data['isbn']:
|
if isbn not in data['isbn']:
|
||||||
data['isbn'].append(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:
|
if 'author' in data:
|
||||||
data['author'] = [data['author']]
|
data['author'] = [data['author']]
|
||||||
if 'title' in data:
|
if 'title' in data:
|
||||||
|
|
Loading…
Add table
Reference in a new issue