From 98dc81b3c7bcfaea107f1a31941edfa1e7893699 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Sat, 2 Oct 2021 19:15:03 +0200 Subject: Bugfixing on openlibrary2lesana --- scripts/openlibrary2lesana | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'scripts/openlibrary2lesana') 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"]: -- cgit v1.2.3