Reforming data inserts

This commit is contained in:
Raelon Masters
2020-06-14 23:58:31 -04:00
parent be5ac2d94f
commit d635c5252c
2 changed files with 21 additions and 2 deletions

View File

@@ -175,8 +175,24 @@ class Catalogue:
cover_image = None cover_image = None
title = book.title().decode("utf-8") title = book.title().decode("utf-8")
author = book.author().decode("utf-8") author = book.author().decode("utf-8")
# TODO some files are still passing encoded data for author. description = None
return [title, author, cover_image, book.f.name] identifier = None
publisher = None
date = None
rights = None
ftags = None
return [
title,
author,
cover_image,
book.f.name,
description,
identifier,
publisher,
date,
rights,
ftags,
]
def extract_content(self, book_zip, book): def extract_content(self, book_zip, book):
""" """

View File

@@ -78,6 +78,9 @@ class Storage:
) )
return True return True
except Exception as e: except Exception as e:
if int(e.pgcode) == 22007:
book[7] = psycopg2.Date(int(book[7]), 1, 1)
self.insert_book(book)
print(e) print(e)
return False return False