summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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"]: