support both author field names

This commit is contained in:
Allie Signet 2021-05-10 20:11:44 -03:00
parent 8c2552f739
commit d40ff5c751

View file

@ -10,14 +10,14 @@ class StorygraphImporter(Importer):
service = "Storygraph" service = "Storygraph"
# mandatory_fields : fields matching the book title and author # mandatory_fields : fields matching the book title and author
mandatory_fields = ["Title", "Author"] mandatory_fields = ["Title"]
def parse_fields(self, entry): def parse_fields(self, entry):
"""custom parsing for storygraph""" """custom parsing for storygraph"""
data = {} data = {}
data["import_source"] = self.service data["import_source"] = self.service
data["Title"] = entry["Title"] data["Title"] = entry["Title"]
data["Author"] = entry["Authors"] data["Author"] = entry["Authors"] if "Authors" in entry else entry["Author"]
data["ISBN13"] = entry["ISBN"] data["ISBN13"] = entry["ISBN"]
data["My Review"] = entry["Review"] data["My Review"] = entry["Review"]
if entry["Star Rating"]: if entry["Star Rating"]: