mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-23 10:01:04 +00:00
Map timestamp to date_added to avoid integrity error.
Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
This commit is contained in:
parent
62c7661fb9
commit
12541d5f1c
1 changed files with 14 additions and 0 deletions
|
@ -9,6 +9,20 @@ class CalibreImporter(Importer):
|
||||||
|
|
||||||
service = "Calibre"
|
service = "Calibre"
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
# Add timestamp to row_mappings_guesses for date_added to avoid
|
||||||
|
# integrity error
|
||||||
|
row_mappings_guesses = []
|
||||||
|
|
||||||
|
for field, mapping in self.row_mappings_guesses:
|
||||||
|
if field in ('date_added',):
|
||||||
|
row_mappings_guesses.append((field, mapping + ['timestamp']))
|
||||||
|
else:
|
||||||
|
row_mappings_guesses.append((field, mapping))
|
||||||
|
|
||||||
|
self.row_mappings_guesses = row_mappings_guesses
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def get_shelf(self, normalized_row):
|
def get_shelf(self, normalized_row):
|
||||||
# Calibre export does not indicate which shelf to use. Go with a default one for now
|
# Calibre export does not indicate which shelf to use. Go with a default one for now
|
||||||
return Shelf.TO_READ
|
return Shelf.TO_READ
|
||||||
|
|
Loading…
Reference in a new issue