diff --git a/oml/item/models.py b/oml/item/models.py index dd91a44..dac80e2 100644 --- a/oml/item/models.py +++ b/oml/item/models.py @@ -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() diff --git a/oml/media/pdf.py b/oml/media/pdf.py index 00f953c..cde5c7c 100644 --- a/oml/media/pdf.py +++ b/oml/media/pdf.py @@ -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 '''