diff --git a/bookwyrm/importer.py b/bookwyrm/importer.py index b6e959cb..a1288400 100644 --- a/bookwyrm/importer.py +++ b/bookwyrm/importer.py @@ -12,7 +12,7 @@ class Importer: service = 'Unknown' delimiter = ',' encoding = 'UTF-8' - mandatory_fields = ['ISBN13', 'Title', 'Author'] + mandatory_fields = ['Title', 'Author'] def create_job(self, user, csv_file, include_reviews, privacy): ''' check over a csv and creates a database entry for the job''' @@ -23,7 +23,7 @@ class Importer: ) for index, entry in enumerate(list(csv.DictReader(csv_file, delimiter=self.delimiter ))): if not all(x in entry for x in self.mandatory_fields): - raise ValueError('Author, title, and isbn must be in data.') + raise ValueError('Author and title must be in data.') entry = self.parse_fields(entry) self.save_item(job, index, entry) return job diff --git a/bookwyrm/librarything_import.py b/bookwyrm/librarything_import.py index 019573ac..0584daad 100644 --- a/bookwyrm/librarything_import.py +++ b/bookwyrm/librarything_import.py @@ -12,8 +12,8 @@ class LibrarythingImporter(Importer): service = 'LibraryThing' delimiter = '\t' encoding = 'ISO-8859-1' - # mandatory_fields : fields matching the book ISBN13, title and author - mandatory_fields = ['ISBN', 'Title', 'Primary Author'] + # mandatory_fields : fields matching the book title and author + mandatory_fields = ['Title', 'Primary Author'] def parse_fields(self, initial): data = {} @@ -23,7 +23,10 @@ class LibrarythingImporter(Importer): data['Author'] = initial['Primary Author'] data['ISBN13'] = initial['ISBN'] data['My Review'] = initial['Review'] - data['My Rating'] = math.ceil(float(initial['Rating'])) + if initial['Rating']: + data['My Rating'] = math.ceil(float(initial['Rating'])) + else: + data['My Rating'] = '' data['Date Added'] = re.sub('\[|\]', '', initial['Entry Date']) data['Date Started'] = re.sub('\[|\]', '', initial['Date Started']) data['Date Read'] = re.sub('\[|\]', '', initial['Date Read']) diff --git a/bookwyrm/templates/import.html b/bookwyrm/templates/import.html index dd60ebff..a7fde76d 100644 --- a/bookwyrm/templates/import.html +++ b/bookwyrm/templates/import.html @@ -10,7 +10,7 @@

Data source