fix pdf info
This commit is contained in:
parent
3cb9819332
commit
7e7478be30
2 changed files with 6 additions and 3 deletions
|
@ -270,7 +270,6 @@ class Item(db.Model):
|
|||
|
||||
# get metadata from external resources
|
||||
self.scrape()
|
||||
self.update()
|
||||
self.update_icons()
|
||||
self.modified = datetime.utcnow()
|
||||
self.save()
|
||||
|
|
|
@ -139,8 +139,7 @@ def info(pdf):
|
|||
if stdnum.isbn.is_valid(value):
|
||||
data['isbn'] = [value]
|
||||
del data['identifier']
|
||||
|
||||
for key, value in data:
|
||||
for key, value in data.iteritems():
|
||||
if isinstance(value, dict):
|
||||
value = ' '.join(value.values())
|
||||
data[key] = value
|
||||
|
@ -151,6 +150,11 @@ def info(pdf):
|
|||
isbn = extract_isbn(text)
|
||||
if isbn:
|
||||
data['isbn'] = [isbn]
|
||||
if 'isbn' in data and isinstance(data['isbn'], basestring):
|
||||
data['isbn'] = [data['isbn']]
|
||||
if 'date' in data and len(data['date']) == 8 and data['date'].isdigit():
|
||||
d = data['date']
|
||||
data['date'] = '%s-%s-%s' % (d[:4], d[4:6], d[6:])
|
||||
return data
|
||||
|
||||
'''
|
||||
|
|
Loading…
Reference in a new issue