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
|
# get metadata from external resources
|
||||||
self.scrape()
|
self.scrape()
|
||||||
self.update()
|
|
||||||
self.update_icons()
|
self.update_icons()
|
||||||
self.modified = datetime.utcnow()
|
self.modified = datetime.utcnow()
|
||||||
self.save()
|
self.save()
|
||||||
|
|
|
@ -139,8 +139,7 @@ def info(pdf):
|
||||||
if stdnum.isbn.is_valid(value):
|
if stdnum.isbn.is_valid(value):
|
||||||
data['isbn'] = [value]
|
data['isbn'] = [value]
|
||||||
del data['identifier']
|
del data['identifier']
|
||||||
|
for key, value in data.iteritems():
|
||||||
for key, value in data:
|
|
||||||
if isinstance(value, dict):
|
if isinstance(value, dict):
|
||||||
value = ' '.join(value.values())
|
value = ' '.join(value.values())
|
||||||
data[key] = value
|
data[key] = value
|
||||||
|
@ -151,6 +150,11 @@ def info(pdf):
|
||||||
isbn = extract_isbn(text)
|
isbn = extract_isbn(text)
|
||||||
if isbn:
|
if isbn:
|
||||||
data['isbn'] = [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
|
return data
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Reference in a new issue