diff options
author | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2021-10-02 19:15:03 +0200 |
---|---|---|
committer | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2021-10-02 19:15:25 +0200 |
commit | 98dc81b3c7bcfaea107f1a31941edfa1e7893699 (patch) | |
tree | a44048d4ff2916a523aac4c94112eb673d266d19 /scripts/openlibrary2lesana | |
parent | 8bde3bb597f4a67590c30c01799c017e99c76c99 (diff) |
Bugfixing on openlibrary2lesana
Diffstat (limited to 'scripts/openlibrary2lesana')
-rwxr-xr-x | scripts/openlibrary2lesana | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/openlibrary2lesana b/scripts/openlibrary2lesana index 4ea94ea..247a8e0 100755 --- a/scripts/openlibrary2lesana +++ b/scripts/openlibrary2lesana @@ -70,13 +70,13 @@ class OL2L(lesana.command.Command): edition = res.json() langs = [] - for l in edition["languages"]: + for l in edition.get("languages", []): langs.append(l["key"].split("/")[-1]) - pub_date = dateutil.parser.parse(edition["publish_date"]) + pub_date = dateutil.parser.parse(edition.get("publish_date")) authors = [] - for aid in edition["authors"]: + for aid in edition.get("authors", []): logging.info("Retrieving %s from OpenLibrary", aid) res = requests.get(OPENAPI_BASE + aid["key"] + ".json") authors.append(res.json()) @@ -93,6 +93,7 @@ class OL2L(lesana.command.Command): data ) filepath = os.path.join(self.collection.itemdir, entry.fname) + filepath = os.path.normpath(filepath) if self.edit_file_in_external_editor(filepath): self.collection.update_cache([entry.fname]) if self.collection.settings["git"]: |