Not all fields are required in ComicVolume and ComicIssue but cacher would fail if any optional field were missing.
This commit is contained in:
parent
9da14e0f95
commit
63e6174cf2
@ -149,13 +149,13 @@ class ComicCacher:
|
||||
"id": record["id"],
|
||||
"source_name": source_name,
|
||||
"name": record["name"],
|
||||
"publisher": record["publisher"],
|
||||
"count_of_issues": record["count_of_issues"],
|
||||
"image_url": record["image_url"],
|
||||
"start_year": record["start_year"],
|
||||
"description": record["description"],
|
||||
"publisher": record.get("publisher", ""),
|
||||
"count_of_issues": record.get("count_of_issues"),
|
||||
"start_year": record.get("start_year"),
|
||||
"image_url": record.get("image_url", ""),
|
||||
"description": record.get("description", ""),
|
||||
"timestamp": datetime.datetime.now(),
|
||||
"aliases": "\n".join(record["aliases"]),
|
||||
"aliases": "\n".join(record.get("aliases", [])),
|
||||
}
|
||||
self.upsert(cur, "volumes", data)
|
||||
|
||||
@ -204,11 +204,13 @@ class ComicCacher:
|
||||
"id": volume_record["id"],
|
||||
"source_name": source_name,
|
||||
"name": volume_record["name"],
|
||||
"publisher": volume_record["publisher"],
|
||||
"count_of_issues": volume_record["count_of_issues"],
|
||||
"start_year": volume_record["start_year"],
|
||||
"publisher": volume_record.get("publisher", ""),
|
||||
"count_of_issues": volume_record.get("count_of_issues"),
|
||||
"start_year": volume_record.get("start_year"),
|
||||
"image_url": volume_record.get("image_url", ""),
|
||||
"description": volume_record.get("description", ""),
|
||||
"timestamp": timestamp,
|
||||
"aliases": "\n".join(volume_record["aliases"]),
|
||||
"aliases": "\n".join(volume_record.get("aliases", [])),
|
||||
}
|
||||
self.upsert(cur, "volumes", data)
|
||||
|
||||
@ -229,19 +231,19 @@ class ComicCacher:
|
||||
"source_name": source_name,
|
||||
"name": issue["name"],
|
||||
"issue_number": issue["issue_number"],
|
||||
"site_detail_url": issue["site_detail_url"],
|
||||
"cover_date": issue["cover_date"],
|
||||
"image_url": issue["image_url"],
|
||||
"thumb_url": issue["image_thumb_url"],
|
||||
"description": issue["description"],
|
||||
"site_detail_url": issue.get("site_detail_url"),
|
||||
"cover_date": issue.get("cover_date"),
|
||||
"image_url": issue.get("image_url", ""),
|
||||
"thumb_url": issue.get("image_thumb_url", ""),
|
||||
"description": issue.get("description", ""),
|
||||
"timestamp": timestamp,
|
||||
"aliases": "\n".join(issue["aliases"]),
|
||||
"alt_image_urls": "\n".join(issue["alt_image_urls"]),
|
||||
"characters": "\n".join(issue["characters"]),
|
||||
"locations": "\n".join(issue["locations"]),
|
||||
"teams": "\n".join(issue["teams"]),
|
||||
"story_arcs": "\n".join(issue["story_arcs"]),
|
||||
"credits": json.dumps(issue["credits"]),
|
||||
"aliases": "\n".join(issue.get("aliases", [])),
|
||||
"alt_image_urls": "\n".join(issue.get("alt_image_urls", [])),
|
||||
"characters": "\n".join(issue.get("characters", [])),
|
||||
"locations": "\n".join(issue.get("locations", [])),
|
||||
"teams": "\n".join(issue.get("teams", [])),
|
||||
"story_arcs": "\n".join(issue.get("story_arcs", [])),
|
||||
"credits": json.dumps(issue.get("credits")),
|
||||
"complete": issue["complete"],
|
||||
}
|
||||
self.upsert(cur, "issues", data)
|
||||
|
Loading…
Reference in New Issue
Block a user