aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2021-10-02 19:15:03 +0200
committerElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2021-10-02 19:15:25 +0200
commit98dc81b3c7bcfaea107f1a31941edfa1e7893699 (patch)
treea44048d4ff2916a523aac4c94112eb673d266d19
parent8bde3bb597f4a67590c30c01799c017e99c76c99 (diff)
Bugfixing on openlibrary2lesana
-rwxr-xr-xscripts/openlibrary2lesana7
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"]: